Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
modwonka
Helper I
Helper I

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 3
Anonymous
Not applicable

Hi @modwonka ,

 

Any updates?

 

Best Regards,
Eyelyn Qin

 

Anonymous
Not 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:

Eyelyn9_1-1646720045205.png

 

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.

edhans
Super User
Super User

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)



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Kudoed Authors