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

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.

Reply
JacksonMaui
Frequent Visitor

Multiple IF statements in DAX

Creating a new Column or Change original - I am trying to Divide a Value in a Column based on the Value's Name. I have multiple NAMEs and VALUEs to change. I am unable to add multiple IF statements. Also if the NAME is not defined how do I pass the original Value to the new column?

 

Column = IF('DSR'[Name]="CureTimeValue",[VALUE]/10)
 
Your help is much appreciated!
1 ACCEPTED SOLUTION
karnold
Resolver I
Resolver I

You could specify another IF() function in the ResultFalse (aka else) parameter. The last IF() would return the original value. See: IF – DAX Guide For example 

Column = IF('DSR'[Name]="CureTimeValue",[VALUE]/10, 
             IF('DSR'[Name]="SomethingelseValue",[VALUE]/15,
                  [Value]
               )
           )

 Another, maybe better option is Switch() SWITCH – DAX Guide. Example:

Column = SWITCH('DSR'[Name],
                "CureTimeValue",[VALUE]/10,
                "SomethingelseValue",[Value]/15,
                [Value]
          )

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

View solution in original post

3 REPLIES 3
JacksonMaui
Frequent Visitor

@karnold I was close, this was perfect solution. Thank you very much!

tamerj1
Super User
Super User

Hi @JacksonMaui 

best is to have all names vs the related value in a lookup (dimension) table. The easiest and most efficient way to proceed after that is to create a one to many relationship. The rest wiuld be a piece of cake. 

karnold
Resolver I
Resolver I

You could specify another IF() function in the ResultFalse (aka else) parameter. The last IF() would return the original value. See: IF – DAX Guide For example 

Column = IF('DSR'[Name]="CureTimeValue",[VALUE]/10, 
             IF('DSR'[Name]="SomethingelseValue",[VALUE]/15,
                  [Value]
               )
           )

 Another, maybe better option is Switch() SWITCH – DAX Guide. Example:

Column = SWITCH('DSR'[Name],
                "CureTimeValue",[VALUE]/10,
                "SomethingelseValue",[Value]/15,
                [Value]
          )

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors