Forum Discussion

1001's avatar
1001
Icon for Resolver II rankResolver II
4 years ago
Solved

Trying to Write a TopN Measure

Hi All,

I have a caclulated column in my Sales table of Over Odered values. I've then created a table visual with Suppliers in rows and Over Orders as a column. I now wish to just display the Top 5 Over Orders in that table visual. How am I able to achieve this? 

 

Thanks. 

  • 1001's avatar
    1001
    4 years ago

    Hi Jiwan, I ended up cheating a little. As you can see from the image (suppliers blurred), I just sorted the graphic highest to lowest and resized the table to only view first four rows. I just thought a measure may simplyfy me resizing the table.  Many thanks.

     

2 Replies

  • Hi,

    I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

    I hope the below can provide some ideas on how to create a solution for your dataset.

     

     

    Top five over ordered: =
    CALCULATE (
        [Over ordered measure:],
        KEEPFILTERS (
            TOPN ( 5, ALL ( Sales[Suppliers] ), [Over ordered measure:], DESC )
        )
    )
    
    • 1001's avatar
      1001
      Icon for Resolver II rankResolver II

      Hi Jiwan, I ended up cheating a little. As you can see from the image (suppliers blurred), I just sorted the graphic highest to lowest and resized the table to only view first four rows. I just thought a measure may simplyfy me resizing the table.  Many thanks.