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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Reconciling two columns - what function to use?

Hi,

 

I'm currently trying to create the "Company B value" column in the table below.

 

We are combining the transactions of Company A and Company B into the same fact table.

 

Company 600 is receiving money from company 700. In the first line we can see that 600 has received the value of £2000 from company 700. In the second line, we can see the transcation from the perspective of company 700, where £2000 has left their account. I need to calculate the Diff column to show inconsistencies in the accounts, which is easy once I have the Company B Value col. Has anyone got a clue how to create this?  

 

Company A IDCompany B IDCompany A ValueCompany B ValueDiff
600700£2000(£2000)£0
700600(£2000)£2000£0
600700£1000(£900)£100
700600(£900)£1000(£100)

 

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

This is my test table:

vyadongfmsft_0-1661419856651.png

 

Please try following DAX to create new columns:

Company A value = IF('Company'[Company A ID]=600,FORMAT('Company'[Company A transaction],"£#"),"("& FORMAT('Company'[Company A transaction],"£#") &")")

Company B value = IF('Company'[Company B ID]=600,FORMAT('Company'[Company B transaction],"£#"),"("& FORMAT('Company'[Company B transaction],"£#") &")")

Diff = 
VAR Diff1 =ABS([Company A transaction]-[Company B transaction])
VAR Diff2 = FORMAT(Diff1,"£#0")
VAR Diff3 = IF([Company A transaction]<[Company B transaction],"("&Diff2&")",Diff2)
return Diff3

 

Then you will get results you want:

vyadongfmsft_1-1661419856654.png

 

Please feel free to let me know if I misunderstood your demands.

 

Best regards,

Yadong Fang

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

View solution in original post

2 REPLIES 2
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

This is my test table:

vyadongfmsft_0-1661419856651.png

 

Please try following DAX to create new columns:

Company A value = IF('Company'[Company A ID]=600,FORMAT('Company'[Company A transaction],"£#"),"("& FORMAT('Company'[Company A transaction],"£#") &")")

Company B value = IF('Company'[Company B ID]=600,FORMAT('Company'[Company B transaction],"£#"),"("& FORMAT('Company'[Company B transaction],"£#") &")")

Diff = 
VAR Diff1 =ABS([Company A transaction]-[Company B transaction])
VAR Diff2 = FORMAT(Diff1,"£#0")
VAR Diff3 = IF([Company A transaction]<[Company B transaction],"("&Diff2&")",Diff2)
return Diff3

 

Then you will get results you want:

vyadongfmsft_1-1661419856654.png

 

Please feel free to let me know if I misunderstood your demands.

 

Best regards,

Yadong Fang

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

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Anonymous - can i consider the shaping your data the following way: 

 

Company CodeAffiliate CodeCompany AmountAffilate AmountDifferenceAbsolute Difference
6007002,000.00-2,000.000.000.00
700600-2,000.002,000.000.000.00
6007001,000.00-900.00100.00100.00
700600-900.001,000.00100.00100.00
600700-1,200.001,000.00-200.00200.00
7006001,000.00-1,200.00-200.00200.00
      
   Total divide by 2-100.00300.00

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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