Forum Discussion

harmon-tuazon's avatar
harmon-tuazon
New Member
2 years ago
Solved

TOPN Functions returns the same value as my COUNT aggregate function

Hey everyone. Sorry super new to posting. I have a measure that supposed to return the top 10 values of a table I'm working with (using Calculate and TopN). I have another measure that just aggregate...
  • Jihwan_Kim's avatar
    2 years ago

    Hi,

    I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file whether it suits your requirement.

     

     

    Sales: = 
    SUM(data[sales])

     

    % top 3 sales: =
    VAR _allsales =
        CALCULATE ( [Sales:], ALL ( data[category] ) )
    VAR _topsales =
        CALCULATE ( [Sales:], TOPN ( 3, ALL ( data[category] ), [Sales:], DESC ) )
    RETURN
        DIVIDE ( _topsales, _allsales )