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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
fzhang
Regular Visitor

Multiply conditions return different results

Hi all, 

 

New to dax here. I have one condition that I need to return values with multiplication and I was able to make it work with the syntax below

 

VAR Sample1 = CALCULATE ([Measure1], 'Account'[Account Level 1] = "A")

RETURN
[Measure1] * 0.5

 

Now I need to include another condition where if 'Account'[Account Level 1] = "B", return [Measure1]

 

How should I write it?

 

Thanks!

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @fzhang ,

 

You could create a measure like below:

 

Measure =
IF (
    SELECTEDVALUE ( 'Account'[Account Level 1] ) = "A",
    [Measure1] * 0.5,
    IF ( SELECTEDVALUE ( 'Account'[Account Level 1] ) = "B", [Measure1] )
)

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @fzhang ,

 

You could create a measure like below:

 

Measure =
IF (
    SELECTEDVALUE ( 'Account'[Account Level 1] ) = "A",
    [Measure1] * 0.5,
    IF ( SELECTEDVALUE ( 'Account'[Account Level 1] ) = "B", [Measure1] )
)

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
johncolley
Solution Sage
Solution Sage

Hi @fzhang ,

 

I suggest you use SWITCH to define multiple conditions

For example:

SWITCH(
TRUE(),
'Account'[Account Level 1] = "A", [Measure 1] * .5,

'Account'[Account Level 1] = "B", [Measure 1]

)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.