Forum Discussion
Help with Top N
- Anonymous2 years ago
Hi esims123 ,
Please try this:SiteTop5 = VAR _table = GENERATE ( ALLSELECTED ( 'Heater Callout Data'[Created].[Month] ), TOPN ( 5, ALLSELECTED ( 'Heater Callout Data'[Site] ), COUNT ( 'Heater Callout Data'[Site] ) ) ) VAR _result = CALCULATE ( COUNT ( 'Heater Callout Data'[Site] ), KEEPFILTERS ( _table ) ) RETURN _resultBest Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi esims123 ,
Please try create a new measure:
SiteTop5 =
VAR _table =
GENERATE(
ALLSELECTED('Calendar'[Month]),
TOPN(
5,
ALLSELECTED('Heater Callout Data'[Site]),
[CountofSite]
)
)
VAR _result = CALCULATE([CountofSite],KEEPFILTERS(_table))
RETURN
_result
And apply it to the y-axis.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
hey, couldnt get this to work, thanks
- Anonymous2 years agoNot applicable
Hi esims123 ,
Please try this:SiteTop5 = VAR _table = GENERATE ( ALLSELECTED ( 'Heater Callout Data'[Created].[Month] ), TOPN ( 5, ALLSELECTED ( 'Heater Callout Data'[Site] ), COUNT ( 'Heater Callout Data'[Site] ) ) ) VAR _result = CALCULATE ( COUNT ( 'Heater Callout Data'[Site] ), KEEPFILTERS ( _table ) ) RETURN _resultBest Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
- esims1232 years agoRegular Visitor
that's great thanks, do you know if theres a way to select the top 5 without there being multiples who are within the top 5. For example there are several sites that have the same number of callouts which mean there are several sites within the top 5 rather than just 5.
thanks