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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Heinrich
Post Patron
Post Patron

Compare 2 rows and highlight differences

Hello
I have a table visual with 4 columns

I would like to compare column A with column C and see if on the same row A+C match.

If not highlight it or filter it out

Regards
Heinrich

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

To compare two columns (Column A and Column C) within the same row and highlight the differences or filter out the rows where they don't match in Power BI, you can follow these steps:

  1. Create a New Calculated Column: Start by creating a calculated column that checks whether Column A matches Column C for each row. If they match, it will return a specific value (e.g., "Match"), and if they don't match, it will return a different value (e.g., "No Match").

    In Power BI Desktop, go to the "Model" view, select your table, and create a new calculated column with the following DAX formula:

MatchStatus = IF([Column A] = [Column C], "Match", "No Match")

 

  1. This formula compares the values in Column A and Column C and assigns "Match" or "No Match" accordingly.

  2. Apply Conditional Formatting: Next, you can apply conditional formatting to visually highlight the differences in your table visual. Here's how you can do it:

    • Select the table visual that you want to format.
    • Go to the "Format" pane on the right.
    • Under "Conditional formatting," select "Background color."
    • Choose the "MatchStatus" column you created as the field to base the formatting on.
    • Define your formatting options, such as setting a background color for "No Match."

    This will highlight the rows where Column A and Column C do not match based on your conditional formatting settings.

  3. (Optional) Filter Rows: If you also want to filter out the rows where Column A and Column C do not match, you can create a visual-level filter. Here's how:

    • Add a slicer or filter visual to your report.
    • Use the "MatchStatus" column as the filter field.
    • Select the value "No Match" to filter out the rows where Column A and Column C do not match.

Now, when you interact with the filter, it will hide the rows where there is no match between Column A and Column C, and your table visual will show only the matching rows with conditional formatting to highlight the differences.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Heinrich
Post Patron
Post Patron

done allready

123abc
Community Champion
Community Champion

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Heinrich
Post Patron
Post Patron

Hello Post Prodigy
Thank you very much.
Take care and have a great day
JFM_12

Heinrich
Post Patron
Post Patron

Hello
Thank you 

But the column A is inother table as column C
Is it possible to compare the A and C in 2 tables
Regards
Heinrich

KEAlexander
Helper I
Helper I

You can do it with a measure and conditional formatting. Create a measure such as Diff = IF([Column A] <> [Column C], 1, 0). Then use conditional formatting in the format section if the visualizations pane to highlight. 

If this solved it, please mark it as the answer. 

123abc
Community Champion
Community Champion

To compare two columns (Column A and Column C) within the same row and highlight the differences or filter out the rows where they don't match in Power BI, you can follow these steps:

  1. Create a New Calculated Column: Start by creating a calculated column that checks whether Column A matches Column C for each row. If they match, it will return a specific value (e.g., "Match"), and if they don't match, it will return a different value (e.g., "No Match").

    In Power BI Desktop, go to the "Model" view, select your table, and create a new calculated column with the following DAX formula:

MatchStatus = IF([Column A] = [Column C], "Match", "No Match")

 

  1. This formula compares the values in Column A and Column C and assigns "Match" or "No Match" accordingly.

  2. Apply Conditional Formatting: Next, you can apply conditional formatting to visually highlight the differences in your table visual. Here's how you can do it:

    • Select the table visual that you want to format.
    • Go to the "Format" pane on the right.
    • Under "Conditional formatting," select "Background color."
    • Choose the "MatchStatus" column you created as the field to base the formatting on.
    • Define your formatting options, such as setting a background color for "No Match."

    This will highlight the rows where Column A and Column C do not match based on your conditional formatting settings.

  3. (Optional) Filter Rows: If you also want to filter out the rows where Column A and Column C do not match, you can create a visual-level filter. Here's how:

    • Add a slicer or filter visual to your report.
    • Use the "MatchStatus" column as the filter field.
    • Select the value "No Match" to filter out the rows where Column A and Column C do not match.

Now, when you interact with the filter, it will hide the rows where there is no match between Column A and Column C, and your table visual will show only the matching rows with conditional formatting to highlight the differences.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.