Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

TOPN Filtering by a Measure Workaround (Live semantic Model Connection)

Hello,   I am currently wokring on making a dashboard which should show Top 10 parts by a paremeter; only problem is this paremeter is  a measure so cannot be used for TOPN Filtering.   Solutions...
  • rajendraongole1's avatar
    2 years ago

    Hi Anonymous - To achieve the desired "Top 10 parts by a measure" visualization by using DAX.

     

    Create a measure to rank your parts

     

    RankMeasure =
    RANKX(
    ALL('PartsTable'),
    [YourMeasure],
    ,
    DESC,
    DENSE
    )

     

    you can replace PartsTable with the name of your table .

     

    In the "Filters on this visual" pane, drag RankMeasure and set it to <= 10.

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    Thanks for the reply from rajendraongole1  and Ashish_Mathur , please allow me to provide another insight: 

     

    You can try this measure.

    Top10Parts =
    SUMX (
        TOPN (
            10,
            SUMMARIZE ( PartsTable, PartsTable[PartID], "MeasureValue", [YourMeasure] ),
            [YourMeasure], DESC
        ),
        [YourMeasure]
    )

     

     For more details please refer to the document:

    TOPN function (DAX) - DAX | Microsoft Learn

    Measures in Analysis Services tabular models | Microsoft Learn

     

    If your Current Period does not refer to this, please clarify in a follow-up reply.

     

    Best Regards,

    Clara Gong

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.