Forum Discussion
Hero11
1 year agoNew Member
Multiple Conditions into 1 Calculated Column
Need some help to finish some DAX. I have 2 Tables (A & B). On Table-A, I have various columns one of which is a Column (TurnArounds) that lists turnaround times by day type: Expedited, Calendar Da...
- 1 year ago
Hi Hero11 Try the below code:
Grab DueDate = VAR CurrentID = 'Table A'[Unique_ID] VAR CurrentTurnAround = 'Table A'[TurnArounds] RETURN SWITCH( CurrentTurnAround, "Expedited", LOOKUPVALUE('Table B'[Expedited], 'Table B'[Unique_ID], CurrentID), "Calendar Days", LOOKUPVALUE('Table B'[Calendar Days], 'Table B'[Unique_ID], CurrentID), "Working Days", LOOKUPVALUE('Table B'[Working Days], 'Table B'[Unique_ID], CurrentID), BLANK() )Here is the expected result:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
divyed
1 year agoSuper User
Hello Hero11 ,
Please use below dax which will give you corresponding due_Dates. It will give you dates if available and leave blank if there is no matching values in table2 so you will have all rows from table1 and matching values from table2 .
Grab DueDate =
VAR CurrentID = 'Tab_1'[Unique_ID]
VAR CurrentTurnAround = 'Tab_1'[TurnAround]
VAR ExpeditedDate = LOOKUPVALUE('Tab_2'[Expedited], 'Tab_2'[Unique_ID], CurrentID)
VAR CalendarDate = LOOKUPVALUE('Tab_2'[Calendar Days], 'Tab_2'[Unique_ID], CurrentID)
VAR WorkingDaysDate = LOOKUPVALUE('Tab_2'[Working Days], 'Tab_2'[Unique_ID], CurrentID)
RETURN
SWITCH(
TRUE(),
CurrentTurnAround = "Expedited" && NOT ISBLANK(ExpeditedDate), ExpeditedDate,
CurrentTurnAround = "Calendar Days" && NOT ISBLANK(CalendarDate), CalendarDate,
CurrentTurnAround = "Working Days" && NOT ISBLANK(WorkingDaysDate), WorkingDaysDate,
BLANK() -- If no match or date not found
)
I hope this will work, if not kindly share expected output to check further.
Did I answer your query ? Mark this as solution if this helps , Kudos are appreciated.
Warm Regards,
Neeraj