The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have the following table (a simplified example is below). I also have a slicer that can select between the categories A,B,C,D. I'm trying to get the ratio of each category when i change the selected value in the slicer. For example, selecting A would produce the result of 0.33.
Measure=divide(calculate(sum(table[value]),table[ID]=1),calculate(sum(table[value]),table[ID]=1,table[category]="Total")))
I believe this doesn't work because the slicer takes precedence of the calculation of the measure. I've tried using the ALL function but it didn't work either.
ID | Category | Value |
1 | A | 5 |
1 | B | 5 |
1 | C | 2 |
1 | D | 3 |
1 | Total | 15 |
Thanks for reading and any help you may provide!
Solved! Go to Solution.
Hi , @qmestu
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can click "New Measure" to create a measure :
Measure = var _total = CALCULATE(SUM('Table'[Value] ),ALL('Table'))
return
DIVIDE( SUM('Table'[Value]) , _total)
(3)Then we put the fileds we need on the visual , and we will meet your need :
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @qmestu
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can click "New Measure" to create a measure :
Measure = var _total = CALCULATE(SUM('Table'[Value] ),ALL('Table'))
return
DIVIDE( SUM('Table'[Value]) , _total)
(3)Then we put the fileds we need on the visual , and we will meet your need :
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly