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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors