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
matthewkaess
Helper I
Helper I

Calculating rental payment due each month

Apologies if I don't get this explanation right.

 

I'm doing some modeling for a company that rents industrial equipment for periods of time that can span multiple months. Each month, they invoice the client an amount based on the per day rate of the rental items multiplied by the time between the last invoice date and the end of the month. The critical dates in the calculation are the "Last Date Invoiced" and the contract "Expiration Date"

 

THe goal is to be able to forecast future revenue.

 

For example, if the Last Invoice Date is 30/06/2020 and the contract Expiration Date is 30/11/2020 the number of months in the period is 5. On 31/07/2020 they will be invoiced for an amount equal to the per day rate of the rental items times the number of days in the month. In this case 31. 

 

I can use DATEDIFF to get the number of Days, Weeks, Months in the rental periods but if I try to use a date slicer, I get blank results. I'm sure the table relationships has something to do with it too but when I try different combinations, it still doesn't work. 

 

Many thanks in advance!

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi  @matthewkaess 

For your case, it is a start date and end date problem, you could try this way as below:

Step1:

you need a separate date table, do not create relationship with fact table

Step2:

Create a measure as below:

 

Total = 
var _table=ADDCOLUMNS('Date',"_unit price per day",CALCULATE(SUM('Table'[Unit price pr Day]),FILTER('Table',MIN('Date'[Date])>'Table'[Invoiced To Date]&&MAX('Date'[Date])<='Table'[Expiration Date])))
return
SUMX(_table,[_unit price per day]
)

 

Step3:

Drag date field from this separate date into slicer and other visual.

 

and here is a similar post, you could refer to:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365

 

here is my sample pbix file, please try it.

 

Regards,

Lin

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

Thank you. I will work on this again after the weekend and update the post.

harshnathani
Community Champion
Community Champion

Hi @matthewkaess ,

 

Can you share some sample data pls.

 

Regards,

HN

matthewkaess_0-1593681822052.png

 

Can do but is is possible to upload an Excel file?

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.