Forum Discussion
Compare Data between 2 excels and color code
I have data in 2 lists where certain values may not match. I want to create a dashboard table visual comparing the primary list against the secondary and highlight in red the values that are not matching or are blank in each column.
Primary excel-
Secondary excel-
Something like below-
How can I achieve this?
You can add an index column to both tables and compare each column based on the index number of the corresponding rows. However, having the same index number doesn't necessarily guarantee that you're comparing the correct rows, as the index number is assigned based on the sorting order in the source files. Ideally, there should be a unique identifier or row ID present in both tables to ensure accurate comparisons. Project ID neither Market column can be used as their values repeat.
- Anonymous1 year ago
Hi Vishruti ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create three measures as below
CF_PrjStatus = VAR _pid = SELECTEDVALUE ( 'Secondary excel'[Project ID] ) VAR _market = SELECTEDVALUE ( 'Secondary excel'[Market] ) VAR _ptype = SELECTEDVALUE ( 'Secondary excel'[Parcel Types] ) VAR _pstatus = SELECTEDVALUE ( 'Secondary excel'[Project Status] ) VAR _primpstatus = CALCULATE ( MAX ( 'Primary excel'[Project Status] ), FILTER ( 'Primary excel', 'Primary excel'[Project ID] = _pid && 'Primary excel'[Market] = _market && 'Primary excel'[Parcel Types] = _ptype ) ) RETURN IF ( _pstatus <> _primpstatus, "pink" )CF_ParcelCode = VAR _pid = SELECTEDVALUE ( 'Secondary excel'[Project ID] ) VAR _market = SELECTEDVALUE ( 'Secondary excel'[Market] ) VAR _ptype = SELECTEDVALUE ( 'Secondary excel'[Parcel Types] ) VAR _parcelcode = SELECTEDVALUE ( 'Secondary excel'[Parcel Code] ) VAR _primparcelcode = CALCULATE ( MAX ( 'Primary excel'[Parcel Code] ), FILTER ( 'Primary excel', 'Primary excel'[Project ID] = _pid && 'Primary excel'[Market] = _market && 'Primary excel'[Parcel Types] = _ptype ) ) RETURN IF ( _parcelcode <> _primparcelcode, "pink" )CF_LanchLead = VAR _pid = SELECTEDVALUE ( 'Secondary excel'[Project ID] ) VAR _market = SELECTEDVALUE ( 'Secondary excel'[Market] ) VAR _ptype = SELECTEDVALUE ( 'Secondary excel'[Parcel Types] ) VAR _launchlead = SELECTEDVALUE ( 'Secondary excel'[Launch Lead] ) VAR _primlaunchlead = CALCULATE ( MAX ( 'Primary excel'[Launch Lead] ), FILTER ( 'Primary excel', 'Primary excel'[Project ID] = _pid && 'Primary excel'[Market] = _market && 'Primary excel'[Parcel Types] = _ptype ) ) RETURN IF ( _launchlead <> _primlaunchlead, "pink" )2. Create the table visual
3. Configure conditional formatting for the above table visual
Best Regards
4 Replies
- VishrutiHelper I
That is my challenge. How do I check row by row?
and yes, i want to compare data in all columns in both lists
- danextianSuper User
You can add an index column to both tables and compare each column based on the index number of the corresponding rows. However, having the same index number doesn't necessarily guarantee that you're comparing the correct rows, as the index number is assigned based on the sorting order in the source files. Ideally, there should be a unique identifier or row ID present in both tables to ensure accurate comparisons. Project ID neither Market column can be used as their values repeat.
- AnonymousNot applicable
Hi Vishruti ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create three measures as below
CF_PrjStatus = VAR _pid = SELECTEDVALUE ( 'Secondary excel'[Project ID] ) VAR _market = SELECTEDVALUE ( 'Secondary excel'[Market] ) VAR _ptype = SELECTEDVALUE ( 'Secondary excel'[Parcel Types] ) VAR _pstatus = SELECTEDVALUE ( 'Secondary excel'[Project Status] ) VAR _primpstatus = CALCULATE ( MAX ( 'Primary excel'[Project Status] ), FILTER ( 'Primary excel', 'Primary excel'[Project ID] = _pid && 'Primary excel'[Market] = _market && 'Primary excel'[Parcel Types] = _ptype ) ) RETURN IF ( _pstatus <> _primpstatus, "pink" )CF_ParcelCode = VAR _pid = SELECTEDVALUE ( 'Secondary excel'[Project ID] ) VAR _market = SELECTEDVALUE ( 'Secondary excel'[Market] ) VAR _ptype = SELECTEDVALUE ( 'Secondary excel'[Parcel Types] ) VAR _parcelcode = SELECTEDVALUE ( 'Secondary excel'[Parcel Code] ) VAR _primparcelcode = CALCULATE ( MAX ( 'Primary excel'[Parcel Code] ), FILTER ( 'Primary excel', 'Primary excel'[Project ID] = _pid && 'Primary excel'[Market] = _market && 'Primary excel'[Parcel Types] = _ptype ) ) RETURN IF ( _parcelcode <> _primparcelcode, "pink" )CF_LanchLead = VAR _pid = SELECTEDVALUE ( 'Secondary excel'[Project ID] ) VAR _market = SELECTEDVALUE ( 'Secondary excel'[Market] ) VAR _ptype = SELECTEDVALUE ( 'Secondary excel'[Parcel Types] ) VAR _launchlead = SELECTEDVALUE ( 'Secondary excel'[Launch Lead] ) VAR _primlaunchlead = CALCULATE ( MAX ( 'Primary excel'[Launch Lead] ), FILTER ( 'Primary excel', 'Primary excel'[Project ID] = _pid && 'Primary excel'[Market] = _market && 'Primary excel'[Parcel Types] = _ptype ) ) RETURN IF ( _launchlead <> _primlaunchlead, "pink" )2. Create the table visual
3. Configure conditional formatting for the above table visual
Best Regards