Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

top5

Hi everyone,

i want to  filter top 5 by cost of material  and visualize it. The following DAX doesnt yield the desired result

Top5 = TOPN(5; SUMMARIZE(Sheet1; Sheet1[Material];"devcosts";  SUM[costs])

after breaking down the DAX to

tmptable =  SUMMARIZE(Sheet1; Sheet1[Material];"devcosts";  SUM[costs])

i could see that the cost column is unsorted, like so

 

how can i get a sorted cost column for the TOPN function to select from and deliver the right solution.

 

thanks in advance

 

  • Anonymous 

     

    Try following

     

    Top5 =
    TOPN (
        5,
        SUMMARIZE ( Sheet1, Sheet1[Material], "devcosts", SUM[costs] ),
        [devcosts], DESC
    )
    

2 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Community Champion

    Anonymous 

     

    Try following

     

    Top5 =
    TOPN (
        5,
        SUMMARIZE ( Sheet1, Sheet1[Material], "devcosts", SUM[costs] ),
        [devcosts], DESC
    )
    
  • v-diye-msft's avatar
    v-diye-msft
    Community Support

    Hi Anonymous 

     

    If you've fixed the issue on your own please kindly share your solution. if the above posts help, please kindly mark it as a solution to help others find it more quickly. thanks a lot!