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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
LostintheBIu
Helper II
Helper II

Dynamic Cost Allocation Data Transformation

Hi data ninjas,

 

I would be very grateful to receive some help regarding how to use Power BI for dynamic Cost Allocation.

 

We have Projects: A, B, C, etc.

Each project has a different number of Budget Lines: 1,2,3,4,5 & blank/uncategorised.

Each project could have any combination of these Budget Lines - a project could have all of the Budget Lines, or only 1 or 2 of them. It is a quite random mix.

For each project we need to allocate the Amounts under Budget Line 4 to the rest of the project's existing Budget Lines (if they are a number, and not blank/uncategorised/other). The amount allocated to each remaining budget line should be relatively sized to how much was originally under that Budget Line, not including the blank/uncategorised/other Budget lines.

 

Please see below.

Thanks in advance for the help! 

 

Original Actuals Fact Table

 

ProjectDescriptionBudget LineAmount
ABudget 11100
ABudget 2250
ABudget 3370
ABudget 4450
    
BBudget 2290
BBudget 44110
BShared Costsblank200
    
CBudget 33100
CShared Costsblank90

etc.

 

Intermediate step: 

 

Apply Replace Values to 'Budget Line' column: If 'Description' column = "Shared Costs" then replace 'Budget Line' = 4

ProjectDescriptionBudget LineAmount
ABudget 11100
ABudget 2250
ABudget 3370
ABudget 4450
    
BBudget 2290
BBudget 44110
BShared Costs4200
    
CBudget 33100
CShared Costs490

 

Final Desired Outcome Table

 

ProjectDescriptionBudget LineAmount
ABudget 11100 + 100/(100+50+70)*50
ABudget 2250 + 50/(100+50+70)*50
ABudget 3370 + 70/(100+50+70)*50
ABudget 440
    
BBudget 2290 + 90/(90)*(110+200)
BBudget 440
BShared Costs40
    
CBudget 33100+100/(100)*90
CShared Costs40
2 REPLIES 2
ThxAlot
Super User
Super User

ThxAlot_0-1768852414820.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Zanqueta
Memorable Member
Memorable Member

Hi @LostintheBIu, this scenario can be solved effectively using Power Query transformations. This is preferable if the allocation should be static and calculated during data preparation.

 

Steps:
  1. Filter out blank/uncategorised lines (except those you have replaced with 4).
  2. Group by Project and calculate:
    • Sum of amounts for Budget Line 4 (SharedCosts).
    • Sum of amounts for other budget lines.
  3. Merge back to original table and create a custom column:
if [Budget Line] <> 4 then 
    [Amount] + ([Amount] / [SumOtherLines]) * [SharedCostAmount]
else 
    0
 
This ensures proportional allocation and sets Budget Line 4 to zero.
 

If this response was helpful in any way, I’d gladly accept a 👍much like the joy of seeing a DAX measure work first time without needing another FILTER.

Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop 🌀.

 
 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.