Forum Discussion
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:
| Country | Users | %GT Users | Slicer selected |
| Los Angeles | 9373700 | 52.22% | none |
| Ventura | 385530 | 2.15% | none |
| Country | Users | %GT Users | Slicer selected | New column |
| Los Angeles | 16 | 6.11% | selected | 52.22/6.11=8.54 |
| Ventura | 1 | 0.38% | selected | 2.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
Solution Specialist
Create a measure like this:
MyMeasure = DIVIDE ( CALCULATE ( [GT%], ALL ( Table[UsersSlicer] ) ), [GT%] ) - V-lianl-msft
Community 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.