Forum Discussion

s15's avatar
s15
Icon for Helper III rankHelper III
9 years ago
Solved

DAX or Measure to show top largest values

Hi all,   I have a list of products and sales revenues. I want to list only 10 products which have the highest sales value. What kind of function can I use in this case?   Saying the product colu...
  • vanessafvg's avatar
    vanessafvg
    9 years ago

    s15

     

    when you say its wrong ,  is it because the total is wrong?  are you filtering on anything else?    or is because its not the top, you should change your asc to desc if you want the top

     

    in terms of the measure you should be able to, for readbility though i would probably change the measure to this

     

     

    Top 2 =
    VAR totalSales =
        SUM ( financials[ Sales] )
    RETURN
        CALCULATE (
            totalSales,
            FILTER (
                VALUES ( financials[Product] ),
                IF (
                    RANKX ( ALL ( financials[Product] ), [Total Sales],, desc) <= 2,
                    [Total Sales],
                    BLANK ()
                )
            )
        )