Forum Discussion
Show value with a If with three conditions
Hi,
I guess this is so easy but I don't know how to do it. If anyone can help me, I would appreciate it.
I wanna filter one Scatter plot graphic through one slicer. Easy. My problem is I would like to have three measures in one.
I have this code, but I don't know how to finish my measure to show one of the var when I filter:
Measure =
var One =
DIVIDE(
CALCULATE(
[Sales],
KEEPFILTERS(Example[Channel] = "One")
)
,
[Sales One]
)
var Two =
DIVIDE(
CALCULATE(
[Sales],
KEEPFILTERS(Example[Channel] = "Two")
)
,
[Sales Two]
)
var Total =
DIVIDE([Sales], [Sales Total])
return IF(
SELECTEDVALUE(
...)
3 Replies
- edhans
Community Champion
Definitely. This is a common pattern known as a SWITCH measure. You create a static table with the 3 values you want (or however many you want) then use SWITCH after the RETURN variable. See this article for a full walkthrough. Switching Metrics in Power BI | Tessellation (tessellationtech.io)
- AnonymousNot applicable
Hi modwonka ,
When will return the variable "Total" data?
var Total = DIVIDE([Sales], [Sales Total])If you want to match variable-one/ variable with the selection in slicer, please try:
Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - AnonymousNot applicable