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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
harirao
Post Prodigy
Post Prodigy

Grouping in Bar Graph Chart

Hi All,

I am working on a visualization, where i have to group below Y axis i.e "Weeks of Visibility" as mentioned below.

  • 0 to 23 weeks should be visible in graph
  • >6 months = Week 24 till 47
  • >12 months = Week 48 till 71
  • >18 months = Week 72 and above3.PNGCan we implement this in this above Bar Graph?

    Regards,
    Hari
1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @harirao ,

 

Based on your description,I created a sample table as below:

Annotation 2020-05-28 130323.png

First create a calculated column to get week number:

 

Weeknum = WEEKNUM('Table (2)'[Date],2)

 

 Then create a calculted column per your request:

 

Column 2 = IF('Table (2)'[Weeknum]>=0&&'Table (2)'[Weeknum]<=23,""&'Table (2)'[Weeknum],IF('Table (2)'[Weeknum]>=24&&'Table (2)'[Weeknum]<=47,">6 months",IF('Table (2)'[Weeknum]>=48&&'Table (2)'[Weeknum]<=71,">12 months",IF('Table (2)'[Weeknum]>=72,">18 months",BLANK()))))

 

Finally you will see:

Annotation 2020-05-28 130729.png

Here is a sample .pbix file you can refer to.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

5 REPLIES 5
v-kelly-msft
Community Support
Community Support

Hi @harirao ,

 

Based on your description,I created a sample table as below:

Annotation 2020-05-28 130323.png

First create a calculated column to get week number:

 

Weeknum = WEEKNUM('Table (2)'[Date],2)

 

 Then create a calculted column per your request:

 

Column 2 = IF('Table (2)'[Weeknum]>=0&&'Table (2)'[Weeknum]<=23,""&'Table (2)'[Weeknum],IF('Table (2)'[Weeknum]>=24&&'Table (2)'[Weeknum]<=47,">6 months",IF('Table (2)'[Weeknum]>=48&&'Table (2)'[Weeknum]<=71,">12 months",IF('Table (2)'[Weeknum]>=72,">18 months",BLANK()))))

 

Finally you will see:

Annotation 2020-05-28 130729.png

Here is a sample .pbix file you can refer to.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
amitchandak
Super User
Super User

@harirao , create a column in your date table using today and you should able to get that

Like this example of month

Month Name =
var _mm= datediff([date],eomonth(today(),0),month)
return 
switch( true(),
_mm =0, "Current Month",
_mm =1, "Last Month",
format([Date],"MMM-YYYY")
)

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

 

 

Hi @amitchandak,

Thanks for your help, but i want Graph to look as mentioned below in Y axis

4.PNG

Please note i will be doing weekly selection.
5.PNG

Month Name =
var _mm= datediff([reportdate],eomonth(today(),0),month)
return
switch( true(),
_mm =0, "Current Month",
_mm =1, "Last Month",
format([reportdate],"MMM-YYYY")
)
Dax written for the above chart
Regards,
Hari 


 

@harirao Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@harirao ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.