Forum Discussion
Multiple Conditions into 1 Calculated Column
- 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
Hi ALL,
Firstly shafiz_p thank you for your solution!
And Hero11 ,Based on your current problem, you may not be able to return the values of the other date columns correctly right?
Since your primary keys are concatenated on a one-to-one or one-to-many basis, then we recommend that you use the realted function to get the values that you need to accomplish what you need to do.
Grab DueDate =
SWITCH(
Table_A[TurnArounds],
"Expedited", RELATED(Table_B[Expedited]),
"Calendar Days", RELATED(Table_B[Calendar Days]),
"Working Days", RELATED(Table_B[Working Days])
)
I hope my code is helpful and I would be honored if it solves your problem!
Hope it helps!
Best regards,
Community Support Team_ Tom Shen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hey Anonymous ,
Looks like the same outcome. It returns the type Expedited, but blanks for both Calendar Days or Business Days. You're correct, the Tables have a One-to-One relationship connected by the Unique_ID (primary key). Thank you for the input. Can I provide any additional info that would help figure out the issue?
- Anonymous1 year agoNot applicable
Hi Hero11 ,
Can you provide some example data or some pbix files so that we can better help you to solve the problem, you can upload your pbix files in the form of web storage so that we can better help you to solve the problem!