Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Percentage Issue

Hello exports,  Here I want the the 5 countries by percantage, but when I did that, it give percet of each country of thr gradn total of this top 5 as you see in right table. But What I want is to ...
  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    Please check the below picture and the attached pbix file.

     

     

    Value country: = 
    SUM( Data[Value] )

     

    Value percent grandtotal: = 
    VAR _valueall =
        CALCULATE ( [Value country:], ALL () )
    RETURN
        DIVIDE ( [Value country:], _valueall )
    

     

    Top five percent: = 
    CALCULATE (
        [Value percent grandtotal:],
        KEEPFILTERS (
            TOPN (
                5,
                ADDCOLUMNS (
                    ALL ( Data[Country] ),
                    "@valuepercent", [Value percent grandtotal:]
                ),
                [@valuepercent], DESC
            )
        )
    )