The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi All,
I have 4 parameters that users can select for the legend of a clustered column chart: Country, Region, Model, and Color.
x axis is month and y axis is count of buyers.
Only when Model is selected, I wish the chart to only display Top 5 Models since there are too many.
Does anyone have idea?
Thank you!
Solved! Go to Solution.
Hi @alya1 ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create measures.
Measure =
COUNTROWS(FILTER(ALLSELECTED('Table'),[Model]=MAX('Table'[Model])))
Measure 2 = RANKX(SUMMARIZE(ALLSELECTED('Table'),[Model],"count",[Measure]),[count],[Measure],DESC,Dense)
Flag = SWITCH(TRUE(),
ISFILTERED('Parameter'[Parameter Fields])=FALSE(),1,
ISFILTERED('Parameter'[Parameter Fields])=TRUE() && SELECTEDVALUE(Parameter[Parameter Fields])<>"'Table'[Model]",1,
SELECTEDVALUE(Parameter[Parameter Fields])="'Table'[Model]" && [Measure 2]<=5,1,0)
(3)Place [Flag=1] on the visual object and then the result is as follows.
Before:
After:
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @alya1 ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create measures.
Measure =
COUNTROWS(FILTER(ALLSELECTED('Table'),[Model]=MAX('Table'[Model])))
Measure 2 = RANKX(SUMMARIZE(ALLSELECTED('Table'),[Model],"count",[Measure]),[count],[Measure],DESC,Dense)
Flag = SWITCH(TRUE(),
ISFILTERED('Parameter'[Parameter Fields])=FALSE(),1,
ISFILTERED('Parameter'[Parameter Fields])=TRUE() && SELECTEDVALUE(Parameter[Parameter Fields])<>"'Table'[Model]",1,
SELECTEDVALUE(Parameter[Parameter Fields])="'Table'[Model]" && [Measure 2]<=5,1,0)
(3)Place [Flag=1] on the visual object and then the result is as follows.
Before:
After:
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much Neeko, this is a great and elegant solution! For some reason with "... && [Measure 2]<=5,1,0)" I get the top 6 Models so I just changed the 5 to a 4 🙂 Much appreciated!