Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Karthik12
Post Patron
Post Patron

Customized bar graph

Hello Team,

I have production date till today which have date and production qty.

I would like plot a month wise bar graph (Month vs production qty) for this year (Jan and Feb 2023).

But,

I would like have customized date selection for Jan, Feb and also coming month.Such a way, From Jan 1 to Jan 27 production date should be come in Jan month and from Jan 28 to Feb 24 should come in Feb month.Like I have different dates for Mar to Dec.

 

Is there any possibility?

 

Karthik12_0-1675860498320.png

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Karthik12 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1675910312910.png

2. add a new column with below dax formula

Adjust Date =
VAR cur_date = [Date]
VAR _val =
    SWITCH (
        TRUE (),
        cur_date >= DATEVALUE ( "2023/01/01" )
            && cur_date <= DATEVALUE ( "2023/01/27" ), DATEVALUE ( "Jan 2023" ),
        cur_date >= DATEVALUE ( "2023/01/28" )
            && cur_date <= DATEVALUE ( "2023/02/24" ), DATEVALUE ( "Feb 2023" ),
        cur_date >= DATEVALUE ( "2023/02/25" )
            && cur_date <= DATEVALUE ( "2023/03/31" ), DATEVALUE ( "Mar 2023" )
    )
RETURN
    _val

3. add a bar chart with fields

vbinbinyumsft_1-1675910423802.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Karthik12 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1675910312910.png

2. add a new column with below dax formula

Adjust Date =
VAR cur_date = [Date]
VAR _val =
    SWITCH (
        TRUE (),
        cur_date >= DATEVALUE ( "2023/01/01" )
            && cur_date <= DATEVALUE ( "2023/01/27" ), DATEVALUE ( "Jan 2023" ),
        cur_date >= DATEVALUE ( "2023/01/28" )
            && cur_date <= DATEVALUE ( "2023/02/24" ), DATEVALUE ( "Feb 2023" ),
        cur_date >= DATEVALUE ( "2023/02/25" )
            && cur_date <= DATEVALUE ( "2023/03/31" ), DATEVALUE ( "Mar 2023" )
    )
RETURN
    _val

3. add a bar chart with fields

vbinbinyumsft_1-1675910423802.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Idrissshatila
Super User
Super User

Hello @Karthik12 ,

 

In the case you should add a calculated column with an if and else statement specifiying that from this date to this date name it January else if its from this date to this date name it Feb and you continue, then you use this column when visualising.

 

If I answered your question, please mark my post as solution so it would appeare to others, Appreciate your Kudos 👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Hi,

Thanks for the hint.

Here am attaching my data model pbix file. Can you share the DAX codes ?

 

Karthik12_0-1675867612619.png

 

Jan 2023 - from 01-01-2023 to 27-01-2023

Feb 2023 - From 28-01-2023 to 24-02-2023

Mar 2023 - Fro m 25-02-2023 to 31-03-2023

 

Thanks in advance for your support !

 

Customized monthly bar graph.pbix

 

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.