Forum Discussion
How to Logically Compare Table01[CategoryID] with Table02[CategoryID] dynamically
- 8 years ago
Here is how I solved this.
Problem was because the column values I wanted to compare resided in two different tables.
factTable[ColumnA]
dimTable[ColumnB]
1. I Used Query Editor to Merge the factTable with the DimTable[ColumnB] I want to compare to.
(Basically it copied ColumnB from DimTable to factTable. For this to work you need a relationship between thetwo tables that work which I had).
Now both of the Columns I want to compare exist in the same table.
2. I used Query Additor => Add Column => Conditional Colum on my factTable.
There I configured IF factTable[ColumnA] Equal To factTable[ColumnB] Set the value of the new conditional column to True
Else if IF factTable[ColumnA] Not Equal To factTable[ColumnB] Set the value of the new conditional column to FalseOtherwise set value of new conditional colum to Problem.
This effectivaly creates a TRUE/FALSE flag that I can filter on.
From this I was able to create a Calculated Column based on my needs where I simply added a filter of factTable[ColumnB] = "True".
Here is how I solved this.
Problem was because the column values I wanted to compare resided in two different tables.
factTable[ColumnA]
dimTable[ColumnB]
1. I Used Query Editor to Merge the factTable with the DimTable[ColumnB] I want to compare to.
(Basically it copied ColumnB from DimTable to factTable. For this to work you need a relationship between the
two tables that work which I had).
Now both of the Columns I want to compare exist in the same table.
2. I used Query Additor => Add Column => Conditional Colum on my factTable.
There I configured IF factTable[ColumnA] Equal To factTable[ColumnB] Set the value of the new conditional column to True
Else if IF factTable[ColumnA] Not Equal To factTable[ColumnB] Set the value of the new conditional column to False
Otherwise set value of new conditional colum to Problem.
This effectivaly creates a TRUE/FALSE flag that I can filter on.
From this I was able to create a Calculated Column based on my needs where I simply added a filter of factTable[ColumnB] = "True".
Hi TobiasF,
Thanks for your sharing. Would you please accept your shared solution as an answer so that it can benefit more users having similar requirement?
Thanks,
Yuliana Gu