cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TWMY1014
Frequent Visitor

Create customized filter (Year) to sort bar chart in descending order

Hi Expert,

 

I have bar chart with years as fitler, like below.
I want to add another "Selected Year" filter (based on which year I select from "Year" filter, single option) and sort bar chart in descending order based on this filter. E.g. I chose Y2022, 2023, 2024 in "Year" filter, same 3 Year will appear in "Selected Year" filter, if I chose selected by Y2023, then bar chart will sort by Y2023 in descending order, but other 2 years data need keep in visual.

TWMY1014_0-1667976162124.png

Thanks a lot.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@TWMY1014 , The year needs to come from an independent date table, create a measure and add that to tool tip and use that for sorting

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Year])
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Year] =_max))



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@TWMY1014 , The year needs to come from an independent date table, create a measure and add that to tool tip and use that for sorting

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Year])
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Year] =_max))



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors