Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
learning2022
New Member

Comparing data in two tables with different columns

Hi

 

I am trying to compare data in two tables with the following scenarios. 

 

Scenario 1 

 

Same number of columns and match the data. Results should highlight the differences in the data.

 

Scenario 2

 

Different number of columns and match the data.  Results should highlight the differences in the data.

 

Currently, I am using the following query, however, the issue is that I have to create comparisons (through measures) for each column.  Is it possible to simplify this formula so that it can cover the entire table in one go?

GoalTypeMatch = 
var _cloupra_goals_type = SELECTEDVALUE(Cloupra_Goal[cloupra__Type__c])
var _practifi_goals_type = SELECTEDVALUE(practifi__Goal__c[practifi__Type__c])
return
if (_cloupra_goals_type=_practifi_goals_type,"Match", "No Match")

Thanks

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @learning2022 ,

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

 

Best Regards,
Community Support Team _ kalyj

rbriga
Impactful Individual
Impactful Individual

Assuming the columns have the same name:

  1. In the query editor, add a manual "source" column.
    1. The value will be [Table 1 name] and [Table 2 name]
  2. Union these 2 tables ("Append Queries" in the query editor).
  3. Create a matrix on the new, appended table.
    1. Each coulumn in the table will go into the matrix values as distinct count
    2. "Source" will go into the matrix columns
  4. If the tables are the same, "distinct count" of any column will show Table1 = Table2 = Total
  5. You can expend on that by adding ID fields to find the difference if needed.
-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.