Forum Discussion
Create a visual that compares two tables and highlights the differences
I'm learning Power BI so excuse my inexperience. I have two tables, TableA & TableB. The sources of these two tables are Start.csv & End.csv. They both have the same columns, Location, Color, Count.
TableA values are:
- England, Blue, 2
- Scotland, Red, 2
TableB values are:
- England, Blue, 1
- Scotland, Red, 2
I'm trying to create a visual that highlights the difference between TableA & TableB by turning the row yellow or adding an colored icon. I have tried adding the Count column from TableB to TableA but I can't seem to figure out how and I'm not sure that is the best method to do this. I have tried to create a new table / columns / measures but seem to be unsuccessful with any attempt. Thanks for any help!
- Anonymous2 years ago
Hi Mathoosala ,
I assume in case you are trying to compare counts with Location, Color consistent. try creating these measures:Count A = SUM('TableA'[Count])Count B = VAR __cur_location = SELECTEDVALUE('TableA'[Location]) VAR __cur_color = SELECTEDVALUE('TableA'[Color]) VAR __result = CALCULATE(SUM('TableB'[Count]),'TableB'[Location]=__cur_location && 'TableB'[Color]=__cur_color) RETURN __resultMeasure = IF([Count A]<>[Count B],"yellow")Please apply [Measure] to the background conditional formatting of each field of the table visual.
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly--How to provide sample data in the Power BI Forum--China Power BI User Group
6 Replies
- lbendlin
Super User
Which of these columns is your primary key to uniquely identify each row?
- Mathoosala
Microsoft Employee
Not sure I follow what you are asking. My thought was to somehow add the Count column from TableB to TableA and then if the Count is different, highlight the row.
- lbendlin
Super User
Is the location the primary key, or the color? If you ask what is different you must also define what stays the same.
- Mathoosala
Microsoft Employee
I honestly don't know. The csv that is creating TableA is static. The other csv that is the source for TableB is updated with new values for count as things change.
- AnonymousNot applicable
Hi Mathoosala ,
I assume in case you are trying to compare counts with Location, Color consistent. try creating these measures:Count A = SUM('TableA'[Count])Count B = VAR __cur_location = SELECTEDVALUE('TableA'[Location]) VAR __cur_color = SELECTEDVALUE('TableA'[Color]) VAR __result = CALCULATE(SUM('TableB'[Count]),'TableB'[Location]=__cur_location && 'TableB'[Color]=__cur_color) RETURN __resultMeasure = IF([Count A]<>[Count B],"yellow")Please apply [Measure] to the background conditional formatting of each field of the table visual.
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly--How to provide sample data in the Power BI Forum--China Power BI User Group
- Mathoosala
Microsoft Employee
This worked great! Thanks, I would have not gotten this on my own, I really appreciate it. All I would add for someone with the same issue is that all the measures should be created for Table A.