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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Report building (DAX)

Hi all,

 

I have two tables in the data field. Both are similar. But I need to make a note if anything changed.

For eg:

I have my two tables which are Table1 and Table2.

 

Table1

Partnocode

1

A
2B
3C
4B

 

Table2

Partnocode

1

B
2A
3C
4B

 

In the above tables, for the same partno, codes are changed. For eg: Partno 1 was A and now B.

I would like to know the number of partnos which have a change of code from table1 to table2.

Can I please know how to do that?

 

Any help is appreciated!

 

Thank you!

Megha

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

Two measures:

Changed = 

var _SelP = SELECTEDVALUE(Table1[Partno])
var _SelCode = SELECTEDVALUE(Table1[code])
var _selCodeInT2 = LOOKUPVALUE(Table2[code], Table2[Partno], _SelP) 

return if ( HASONEVALUE(Table1[Partno])  , if ( _SelCode = _selCodeInT2 , "Same Value", "Value Changed"), blank())

 

Count Changed = Coalesce(CALCULATE( count(Table1[Partno]), FILTER(Table1, [Changed] = "Value Changed")), 0)

Note: I did as two measures, you can club as one too

 

 Results as:

sevenhills_0-1646344321072.png

 

sevenhills_1-1646344357351.png

 

 

View solution in original post

3 REPLIES 3
VahidDM
Super User
Super User

HI @Anonymous 

 

If you just want a number that indicate the total changes, you can use this measure code:

Change = 
Var _A = EXCEPT(Table2,Table1)
return
COUNTROWS(_A)

 

Output:

VahidDM_0-1646345347441.png

 

 

You can create a new table with below code to just find the items that changed in Table 2 in compare to table 1:

 

Table = EXCEPT(Table2,table1)

 

Output:

VahidDM_1-1646345435791.png

 

 

Sample file atached.

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

sevenhills
Super User
Super User

Two measures:

Changed = 

var _SelP = SELECTEDVALUE(Table1[Partno])
var _SelCode = SELECTEDVALUE(Table1[code])
var _selCodeInT2 = LOOKUPVALUE(Table2[code], Table2[Partno], _SelP) 

return if ( HASONEVALUE(Table1[Partno])  , if ( _SelCode = _selCodeInT2 , "Same Value", "Value Changed"), blank())

 

Count Changed = Coalesce(CALCULATE( count(Table1[Partno]), FILTER(Table1, [Changed] = "Value Changed")), 0)

Note: I did as two measures, you can club as one too

 

 Results as:

sevenhills_0-1646344321072.png

 

sevenhills_1-1646344357351.png

 

 

Anonymous
Not applicable

Thank you! @sevenhills 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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