Forum Discussion
SWITCH using conditions from two tables
- Anonymous1 year ago
Hi PBInewbie00 ,
I ceate a table as you mentioned.
Then I think you can create a new calculated column.
Column = SWITCH( TRUE(), 'Table'[PRODUCT] = "Cash" && 'Table'[CODE] = "ASST", "CASH", 'Table'[PRODUCT] = "Assets" && 'Table'[CODE] = "ASST", "ASST", 'Table'[PRODUCT] = "Commission" && 'Table'[CODE] = "COMM", "COMM", 'Table'[PRODUCT] = "Derivatives" && 'Table'[CODE] = "DERIV", "DERIV", 'Table'[PRODUCT] = "Cash" && 'Table'[CODE] = "DERIV", "CASH", 'Table'[PRODUCT] = "Cash" && 'Table'[CODE] = "LOAN", "CASH", 'Table'[PRODUCT] = "Loans" && 'Table'[CODE] = "LOAN", "LOAN", BLANK() )Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lbendlin Hi - thank you for responding. To clarify - I used versions of the formulas for both measures and columns. The ones I wrote out were for when I tried to create measures. Please let me know if you need further info.
Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.
- PBInewbie001 year agoNew Member
Hi lbendlin - I provided the table at the end of the my original post with the sample data, expected results, and current results.
Reposting below for convenience. Please let me know if this is not sufficient.
CODE PRODUCT EXPECTED CURRENT ASST Cash CASH ASST ASST Assets ASST ASST COMM Commission COMM COMM DERIV Derivatives DERIV DERIV DERIV Cash CASH DERIV LOAN Cash CASH LOAN LOAN Loans LOAN LOAN - lbendlin1 year agoSuper User
So you have two single column tables? Where do you want the result to be stored? In one of the tables?
- PBInewbie001 year agoNew Member
lbendlin The two tables have other columns, but I'm trying to pull from those specific columns. I'm ok with storing the results in one of the tables (I wasn't sure if storing it in a specific table was affecting the actual result). Thanks again for your help on this!