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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
BHarm65
Frequent Visitor

Get values from related company in same table

Hi All,

 

I am strugeling with the following data questing.

We have intercompany transactions between differeent companies.

All the transactions are in the tabel GL_IC_Entries.

A transaction is marked with the sending company and the receiving company with a value and a posting / transaction date.

 

We want to have an overview if all entries between the different companies are balanced per week / month

I tried diffente approaches with calculated columns and measures with lookupvalues, but I don't get the correct data in my table.

 

 

Overview GL_IC_Entries example

CompanyPosting DateAccountDescriptionAmountIC Company
CompanyA1-2-20231401IC Transfer1.000,00CompanyB
CompanyA1-2-20231401IC Transfer2.000,00CompanyC
CompanyB3-2-20231401IC Transfer5.000,00CompanyD
CompanyB1-2-20231401IC Transfer1.000,00CompanyA
CompanyD3-2-20231401IC Transfer5.000,00CompanyB
      

 

Wanted result

Date selector at the top where I can select the year / month or week

 

Date = Month February 2023

 

PeriodCompanyAmountIC CompanyAmountDifference
2023, FebruaryCompanyA1.000,00CompanyB1.000,000
2023, FebruaryCompanyA2.000,00CompanyC0,002.000,00
2023, FebruaryCompanyB1.000,00CompanyA1.000,000
2023, FebruaryCompanyB5.000,00CompanyD5.000,000
2023, FebruaryCompanyD5.000,00CompanyB5.000,000

 

Based on this outcome we can conclude that one of the IC entries is not balanced between CompanyA and CompanyC in the month of February.

 

Can someone advice me how to create a solution.

Many thanks in Advance

 

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

Hi @BHarm65 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create two measures. 

IC_Amount = 
var _a=CALCULATE(MIN('Table'[Amount]),FILTER(ALL('Table'),'Table'[Company]=MAX('Table'[IC Company]) &&'Table'[Posting Date]=MAX('Table'[Posting Date] )))
return
IF(_a=BLANK(),0,_a)
Difference = 
var _a=MAX('Table'[Amount])-'Table'[IC_Amount]
return 
IF(_a=0,BLANK(),_a)

(3) Then the result is as follows.

vtangjiemsft_1-1681800037590.png

 

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @BHarm65 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create two measures. 

IC_Amount = 
var _a=CALCULATE(MIN('Table'[Amount]),FILTER(ALL('Table'),'Table'[Company]=MAX('Table'[IC Company]) &&'Table'[Posting Date]=MAX('Table'[Posting Date] )))
return
IF(_a=BLANK(),0,_a)
Difference = 
var _a=MAX('Table'[Amount])-'Table'[IC_Amount]
return 
IF(_a=0,BLANK(),_a)

(3) Then the result is as follows.

vtangjiemsft_1-1681800037590.png

 

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

olgad
Super User
Super User

Hi, how are they linked with each other the tables?

Create a composite primary key in both tables

Primary Key=Table[Date]&"-"&Table[Company]&"-"&Table[IC Company]
*in one table date will be based on Period, in the other on posting date
link them on that. 
Please note that Posting Date in one table and period in the other table have to be the same format. I dont know what are the datat types of those columns, but you can create a column Date=Startofmonth(Posting Date) and  please make the same format for the period. 



DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime
BHarm65
Frequent Visitor

Hi,

 

Thank for you reply.

 

I possibly didn't make myself clear.

 

All entries are in one tabe.

I created a date table and connected it to the GL_IC_Table

BHarm65_0-1680509404568.png

 

Visual

BHarm65_1-1680510079532.png

How do I get the amount for the IC company Calculated based on the date slicer.

The amount is in the same GL_IC_Table.

 

Hope this helps

Best Brian

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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