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
einrikr
Frequent Visitor

IF value is x then a and if value is y then b

Hi all,

 

I think I'm massively overcomplicating my problem but as I'm quite new to DAX, I'd love to learn what I'm doing wrong.

I want to do something presumably extremely basic, but can't fathom how to do it...

 

My report has a column with 2 possible values: audit, or regulatory. Based on these values, I want to retreive values in other columns. If the value is 'audit', I want to retreive the deadline for testing purposes, stored in column 'validation deadline audit'. 

If the valuw is 'regulatory', I want to retreive the deadline in column 'validation deadline regulatory'. 

 

It seems pretty simple to do but I don't get what I'm supposed to be using. Can anyone of you help please?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @einrikr ,

 

I am going to assume that you want to evaluate everything on the same row. I would create a new calculated column.

 

Deadline = if([ColumnNameAuditorRegulatory]="Audit",[valididation deadline audit],[validatation deadline regulatory])

 

-Paul

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @einrikr ,

 

I am going to assume that you want to evaluate everything on the same row. I would create a new calculated column.

 

Deadline = if([ColumnNameAuditorRegulatory]="Audit",[valididation deadline audit],[validatation deadline regulatory])

 

-Paul

Anonymous
Not applicable

Show the data model. We need to know how your tables are linked.

Best
D

Thanks for your reply @Anonymous darlove, see below.

It's all in one table, but somehow I still don't get what I should do... 

 

snip.PNG

Anonymous
Not applicable

@einrikr 

If it's all in one table, you can definitely use my formula above.

It certainly did, thank you very much! 

 

I expected that I would have to specify 'if value is x, then a or and if value is y, then b' but that's not the case 🙂 

Anonymous
Not applicable

Awesome. Glad it worked. But yes, the format for if statements are if(evaluation, result if true, result if false).

 

If you're using a switch function (for handling multiple ifs, then you'd have to specify the various values)...

switch([values],"Audit",[auditdatecolumn],"Value2",[value2datecolumn],"Value3",[value3datecolumn],"Alternate Value")

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