I have a truck fleet, and every truck is rented on the spot market (to pick a cargo from A to B) and based on a daily rate.
In the “Hire Log” table, I have the hiring pick date and time, the delivery date and time, and the Daily rate. To have the relationship with my “DIM_Date,” I duplicate both columns’ dates to have just the date!
From the “Hire Log” table, I create a new table, “Fact_Daily_revenue”, as per the example with the one entry per day for each hires day!
I need some help because the time is not taken into consideration on the daily cost revenue. If I take the Date/time column in the crossjoin, I do not build the table!
So in the example, you can see that the hire starts at different times of the day and normally also delivers at other times of the day, so in the first and last renting day, the partial day needs to multiply with hired rate.
Thank you for your support
Jose Milhazes example.pbix (99.2 KB)
To achieve the results based on the conditions that you’ve specified. Below are the measures alongwith the screenshot of the final results provided for the reference purposes -
I’m also attaching the working of the PBIX file as well as providing a link below of the post where almost similar type of query was posted onto the forum and how the solution was achieved for your reference.
Also, if you would like to see the totals in your table and want to fix it. One of our expert had already created a post which addresses that issue in depth and contains the different types of scenario’s as well as link of the videos. Below is the link of that post provided for the reference purposes as well. In the current file as well, I’ve used the similar approach to fix the totals.
Hoping you find this useful and meets your requirements that you’ve been looking for.
Important Notes:
1). In your data, for one of the row you didn’t had a “Delivery Date” so it’s presumed that it’s still in-transit as of today and rates continue to multiply with it .
2). For one of the rows, you had Pick Date as “29th January, 2021” and Delivery Date as “28th January, 2021” which is impossible unless your truck drivers are time travellers so I changed the Delivery Date to something else i.e. 28th February, 2021.
3). Your partial start date and end date are considered as one full day and accordingly the results are evaluated. You can modify the measure or formula as per your business scenario to suit your requirements, if necessary.
Hi @Harsh, thank you so much for your reply!
Starting with the notes: 1st indeed if blank the truck still in transit at contracted rate; 2nd I’m sorry and thank you. Did fix with the same date.
The 3rd was the help I was requesting. Our customers do not what to pay the full day!
Example:
Pick Date & Time: 2/28/21 7:00 PM
So for that day will be >> 2/28/21 7:00 PM - 2/28/21 12:00 AM = 0.791666667 (day)
So on Fev/28 the revenue was >> 0.791666667 * $500 = $395.83
In the attachment, you can find the files with the fix Date!
I’m converting the “Hire Log” into a FACT_DAY_Renevue since there are other types of revenues and costs per day (e.g. Driver; Fuel; Positioning; Cleaning, Etc). From there we will trace the total profit per day!
Thank you so much for the effort, warm regards, and be safe!
So to achieve the results as per the third condition that you’ve specified wherein your customers don’t want to pay for an entire day but want to pay proportionally. Below is the new measure alongwith the screenshot of the final results provided for the reference -