Forum Discussion
Multiple Condition If Statements
- 4 years ago
Here is the solution to the above problem statement. This is a multi step solution:
Step 1: Power Query
Edit the query underpinning the Primary Data table by creating a new column and merging the "ME Date" and "Transaction ID" fields.=Text.Combine({Text.From([Date], "en-GB"), "-", Text.From([Transaction ID], "en-GB")})
As this should be a unique value, this can be further refined by removing any erroneous duplicates.
Repeat the above process for the "Vendor1" and "Vendor2" tables.
Step 2: Desktop
Now that we have unique references in all source tables, we can create a one to one link between the Primary Data table and the two vendor data tables.
With new tables relationships established, we can now easily add new columns to the Primary Data table using DAX (one column per vendor data table) using the formula:Vendor1 Tag = RELATED('Vendor1 Data'[Vendor ID])
We can use similar logic to create a third column to identify any unmatched items using the following DAX formula:Not Found = IF ( 'Primary Data'[Vendor1 Tag] = BLANK () && 'Primary Data'[Vendor2 Tag] = BLANK (), "Not found", BLANK () )
Greg_Deckler , then perhaps a measure is not the correct solution. Perhaps I need to add 2 columns to the Primary Data table pulling in the Vendor ID into the respective columns, then a 3rd column to denote any transactions which are blank.
What would be the correct DAX code to acheive the above?
Thanks?
G_Whit-UK Well, your other problem is that RELATED won't work across a many-to-many relationship. There is a lot of unknowns here. I recommend that you provide more sample data or a sample PBIX that can fully replicate your situation. That's the only way to test and really be sure of a solution.