Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I wish to calculate the result based on my category. If the category is A then it is qty * parameter
if the category is B then qty * parameter * 3, and when category is C, then it should be qty.
I am able to do that for each of the categories independently. But not in a one common measure.
Can you please suggest how to do it?
Solved! Go to Solution.
@veenashenolikar , If these are parameters and they are dynamic, means coming from slicer or what if; you can not have a column.
if they are static, you can try column like
Switch( True() ,
(Table[category]) = "A" , 2 * Sum(Table[qty]),
(Table[category]) = "C" , 3 * Sum(Table[qty]),
(Table[qty])
)
@veenashenolikar , If these are parameters and they are dynamic, means coming from slicer or what if; you can not have a column.
if they are static, you can try column like
Switch( True() ,
(Table[category]) = "A" , 2 * Sum(Table[qty]),
(Table[category]) = "C" , 3 * Sum(Table[qty]),
(Table[qty])
)
Yes, it does that for measures. You will have to create a calculated column for that rather than a measure.
Get back to me if you need any more help.
@lalTel20 , Try a measure like
Sumx(Values(Table[category]) ,
Switch( True() ,
max(Table[category]) = "A" , selectedvalue(parameter1[parameter1]) * Sum(Table[qty]),
max(Table[category]) = "C" , selectedvalue(parameter3[parameter3]) * Sum(Table[qty]),
Sum(Table[qty])
)
You need to write a measure with Switch or IF-Else . Before that can you tell me if you have only 3 categories or are there more?
There are 5 categories. But the switch / if function doesnt allow me to select a category to use in the function.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |