Forum Discussion

sarjensystems1's avatar
sarjensystems1
Icon for Helper III rankHelper III
6 years ago
Solved

Dynamic Top N with hirarchy in matrix Visual

Hii i have a requirement to display dynamic Top N category based on country and i am using Matrix visual i am using this DAX function TopN Sales= VAR SelectedTop = SELECTEDVALUE('TopN'[...
  • v-kelly-msft's avatar
    6 years ago

    Hi sarjensystems1 ,

     

    I have changed your measure and I guess this time it will satisfy your need:

     

     

    TopN Sales = 
    VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])
    RETURN
    SWITCH(TRUE(),
    SelectedTop = 0, [sales],
    RANKX ( 
    ALL('Table'),
    [sales]
    )
    <= SelectedTop,
    [sales]
    )

     

    And you will see:

     

     

    For the related .pbix file,pls click here.

     


     
    Best Regards,
    Kelly