Forum Discussion
Comparing Difference between two columns in two different tables
- 3 years ago
Hi Anonymous
Please create a dimension table that contains all ticket numbers. This can be created in power query or can be a calculated table using the following dax
Tickets =
DISTINCT (
UNION (
ALLNOBLANKROW ( Table1[Ticket Num] ),
ALLNOBLANKROW ( Table2[Ticket Num] )
)
)
then you apply the following measureDifference =
COALESCE (
SUMX (
VALUES ( Tickets[Ticket Num] ),
CALCULATE (
VAR Val1 =
SUM ( Table1[Value] )
VAR Val2 =
SUM ( Table1[Value] )
RETURN
IF ( Val1 <> BLANK () && Val2 <> BLANK (), Val2 - Val1 )
)
),
"No Match"
)
Hi Anonymous
First we need to create a relationship between the two tables, common Column is Tikcket number.
Second, we match the values or ticket numbers by creating calculated column so
Third we Calculate the difference =
Finally Create your table so
M4, Volume from table 1, volume from table 2, M3.
I hope this helps and please check the answer if it is right
Hey Galaamri, thank you for being willing to help. I do believe this would be the solution if I could get the relationship to work.
When creating m4, I get the error "The column 'table 2 [ticket number]' either doesn't exist or doesn't have a relationship to any table available in the current context".
Extra info in case any of these help with solving the errors:
-I am attempting to create the calculated column column inside of table 1
-The ticket numbers from table 1 and table 2 will not match, a lot will but a lot will not. Some also include characters instead of just numbers. Both ticket columns are data type "text".
-When creating a relationship between the two before attempting to create m4, it makes a "many to many" relationship".