Forum Discussion

ww1711's avatar
ww1711
Frequent Visitor
7 years ago
Solved

Dynamic table creation

Hello,   I have a requirement to show the top-5 values within a dataset based on user selections.   I have a dataset that returns volume by: Month Company Activity Group What I'm looking to...
  • v-jiascu-msft's avatar
    7 years ago

    Hi ww1711,

     

    Please check out the demo in the attachment. Since there are some groups that don't exist in some days, we need to create a [Groups] table first.

    1. Create a new table.

    Groups = VALUES(Table1[Group])

    2. Create a measure.

    Rank =
    VAR ranks =
        CALCULATE (
            RANKX ( ALL ( Groups[Group] ), CALCULATE ( SUM ( Table1[Volume] ) ) ),
            ALL ( Table1[Month] )
        )
    RETURN
        IF ( ranks <= 5, ranks, BLANK () )
    

    Dynamic-table-creation2

     

    Best Regards,
    Dale