Forum Discussion
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 aboveCan we implement this in this above Bar Graph?
Regards,
Hari
Hi harirao ,
Based on your description,I created a sample table as below:
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:
Here is a sample .pbix file you can refer to.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
5 Replies
- amitchandakSuper 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-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.- hariraoPost Prodigy
Hi amitchandak,
Thanks for your help, but i want Graph to look as mentioned below in Y axisPlease note i will be doing weekly selection.
Month Name =var _mm= datediff([reportdate],eomonth(today(),0),month)returnswitch( true(),_mm =0, "Current Month",_mm =1, "Last Month",format([reportdate],"MMM-YYYY"))
Dax written for the above chartRegards,
Hari
- amitchandakSuper User
harirao ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
- v-kelly-msftCommunity Support
Hi harirao ,
Based on your description,I created a sample table as below:
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:
Here is a sample .pbix file you can refer to.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!