Forum Discussion

esims123's avatar
esims123
Regular Visitor
2 years ago
Solved

Help with Top N

I want to have the top 5 sites appearing within my dataset by each month.   Currently I can only get the top 5 appearing overall rather than depending on month.    The collumn "Created" is the da...
  • Anonymous's avatar
    Anonymous
    2 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
        _result

    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