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

Prorate Costs

Hello, here's my problem. I have three tables:

  1. Events
  2. Maintenance
  3. Fuel

Table 1 is a table of events, with the following columns: Event ID, Date, Time, Truck Number, Zone, etc

Table 2 and 3 have the following columns: ID, Truck Number, Date, Time, Cost, etc

 

I want to create two calculated columns in table 1, called "Cost of Manteinance" and "Cost of Fuel". 

 

The cost of manteinance of one event is the cost of the closest manteinance of the corresponding truck number (done before the event) divided by the number of events of the corresponding truck that are between said mantainance and the following corresponding mantainance. Tha same should be done for "Cost of Fuel".

 

I other words, I want to prorate the cost of every manteinance work (and fuel load) between the corresponding events of every truck. In the end the sum of the costs of every event should be equal to the sum of the costs of tables 2 and 3.

 

How can this be done?

 

I'm not so sure if this is the correct approach to prorating costs.  If you have any better ideas please let me know!

 

 

1 REPLY 1
CheenuSing
Community Champion
Community Champion

Hi @ivan_xd

 

Please share some data and the output expected. You can put it in OneDrive and provide the link.

 

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

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.