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
eddiensk
Frequent Visitor

How to calculate and distribute JV percentage based on entities allocation using DAX

Hi Guru,

 

i have a scenario that i need help. We have a table that stores the distribution percentages from JV entities to our primary entities as below. In below example, assuming the measures to be distributed is Costs ($). 

 

for Entity Company C, the total cost = Costs of company C + Costs of company E x 35% + costs of company F x 32%

 

Target EntitySource EntitiesOwnership % of Source Entity
Company ACompany B50
Company CCompany E35
Company CCompany F32
Company DCompany E30
Company DCompany F20

 

assuming the transaction table store are as below. The distributed costs are calcualted based on formula and percentages of distribution to get the JV costs and then the total costs

 

EntityOwn Cost ($)Distributed JV CostsTotal Costs
Company B120001200
Company A20006002600
Company E350003500
Company F150001500
Company C300017054705
Company D500013506350

 

example above shows

entity Company A = $2000 (costs of Entity Company A) + $1200 * 0.5 (Costs of JV Company B) = $ 2600

 

anyone can help with me this please. Been cracking for a week ... guess it is too challenging for a new bie like me 😞

 

Cheers
Ed

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @eddiensk 

 

You can use Power Query Editor to calculate the Distributed JV Costs and Total Costs. First import two tables into Power BI and click Transform data to launch Power Query Editor. 

 

I transform the transaction table with Merge Queries feature twice and Group by feature once. Also add some custom columns. Merge Queries feature is very useful when you want to bring data from another table (or the table itself) by one or more matching columns. Group by feature is very helpful when you want to calculate the aggregated values by some columns (groups). You can download the attached pbix file at bottom to see detailed transformation steps. Let me know if you have any questions. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @eddiensk 

 

You can use Power Query Editor to calculate the Distributed JV Costs and Total Costs. First import two tables into Power BI and click Transform data to launch Power Query Editor. 

 

I transform the transaction table with Merge Queries feature twice and Group by feature once. Also add some custom columns. Merge Queries feature is very useful when you want to bring data from another table (or the table itself) by one or more matching columns. Group by feature is very helpful when you want to calculate the aggregated values by some columns (groups). You can download the attached pbix file at bottom to see detailed transformation steps. Let me know if you have any questions. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Thanks Jing, i have tried your suggested method and it works. However, i have another measure that i need to distribute, which is count of invoices. This count of invoice is currently implemented as measure based on CountX (table, table(accounting document) & table(year) & table(company code).

 

I couldn't get this work using the power query to distribute the counts as the fact table has granularity deeper than the 3 fields above. I need those other fields for ensuring all filters are considered.

 

The other dilemma i have is the fact table is large, so using the power query seems to be slow and need to introduce a few other tables due to merging as new table. I have incremental refresh for the original fact table, do i need to implement the incremental refresh for the merged table as well?

 

thanks

eddie

thanks Jing,

 

appreciate your response. in my real scenario it is more complicated than that. 

- the Own Costs is actually a calculated amount itself based on multiple cost fields, calculation and filters and the filters needs to be preserved as well when doing the distribution. This calculated "Own Costs" is defined as one of the measure. 

 

Is there another way to do the distribution based on the calculated measure?

 

thanks heaps

eddiensk
Frequent Visitor

 any help very much appreciated...

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.