Forum Discussion
compare columns in two tables with same column names
- 9 years ago
Hi pxg08680,
According to your description above, you should be able to use the formula below to create a new measure and show it on the report to get the actual difference. :smileyhappy:
Diff = SUM ( CommercialBuyIntentVisits[MetricValue] ) - SUM ( CubeData[CommercialBuyIntentVisits] )Regards
HI pxg08680
Have you tried the following to create a new calculated table?
TableC = UNION(
EXCEPT(TableA,TableB),
EXCEPT(TableB,TableA)
)Thanks for the reply.
I have tried it but the problem is I dont have same number of columns in both the tables as EXCEPT takes only same number of column tables. As you can see the below picture i was trying to compare data. Pink color data is from a differemce source and ornage color is from a different source.
- Phil_Seamark9 years ago
Microsoft Employee
Hi pxg08680
A slight tweak is to use the SELECTCOLUMNS function to choose which columns you want from each table (and to make sure the column count alignts)
TableC = UNION( EXCEPT(SELECTCOLUMNS(TableA,"Col",[Column1]) ,SELECTCOLUMNS(TableB,"Col",[Column1]) ), EXCEPT(SELECTCOLUMNS(TableB,"Col",[Column1]) ,SELECTCOLUMNS(TableA,"Col",[Column1]) ) )- pxg086809 years ago
Resolver III
I did'nt get what this means.
Thanks
- Phil_Seamark9 years ago
Microsoft Employee
Hi there
Please try this. Does your Model table have a column called [CommercialBuyIntentVisits] which is also the same name that you have one of the tables?
TableC = UNION( EXCEPT( SELECTCOLUMNS(CommercialBuyIntentVisits,"Col",[MetricValue]) , SELECTCOLUMNS('Model',"Col",[CommercialBuyIntentVisits]) ), EXCEPT( SELECTCOLUMNS('Model',"Col",[CommercialBuyIntentVisits]) , SELECTCOLUMNS(CommercialBuyIntentVisits,"Col",[MetricValue]) ) )