Forum Discussion

Raj007's avatar
Raj007
Icon for Helper III rankHelper III
5 years ago
Solved

Creating a column to display slicer selected value calculation

Hi,

 

I have a requirement where I have 2 columns Country and Users, %GT Users is ahieved by showing value as percentage of grand total, as shown below. Also, there is a slicer slug.

 

My requirment is to display a column which divides %GT users without any slicer selected value with %GT value with selected slicer.

Eg: 

CountryUsers%GT UsersSlicer selected
Los Angeles937370052.22%none
Ventura3855302.15%none

 

CountryUsers%GT UsersSlicer selectedNew column
Los Angeles166.11%selected52.22/6.11=8.54
Ventura10.38%selected2.15/0.38=5.65

The new column should be created in Power BI as shown please suggest.

 

Any help would be highly apreciated.

Thanks in Advance,

Neelofar.

  • Hi Raj007 ,

     

    Please refer to:

    Measure = 
    VAR _COUNTRY = CALCULATE(SUM('Table'[Users]),ALLEXCEPT('Table','Table'[Country]))
    VAR _TOTAL = CALCULATE(SUM('Table'[Users]),ALL('Table'))
    VAR PERCENTAGE_ = DIVIDE(_COUNTRY,_TOTAL)
    VAR CURRENT_ = DIVIDE(SUM('Table'[Users]),_TOTAL)
    RETURN DIVIDE(PERCENTAGE_,CURRENT_)

     

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Mohammad_Refaei's avatar
    Mohammad_Refaei
    Icon for Solution Specialist rankSolution Specialist

    Create a measure like this:

    MyMeasure =
    DIVIDE ( CALCULATE ( [GT%], ALL ( Table[UsersSlicer] ) ), [GT%] )
  • V-lianl-msft's avatar
    V-lianl-msft
    Icon for Community Support rankCommunity Support

    Hi Raj007 ,

     

    Please refer to:

    Measure = 
    VAR _COUNTRY = CALCULATE(SUM('Table'[Users]),ALLEXCEPT('Table','Table'[Country]))
    VAR _TOTAL = CALCULATE(SUM('Table'[Users]),ALL('Table'))
    VAR PERCENTAGE_ = DIVIDE(_COUNTRY,_TOTAL)
    VAR CURRENT_ = DIVIDE(SUM('Table'[Users]),_TOTAL)
    RETURN DIVIDE(PERCENTAGE_,CURRENT_)

     

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.