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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jake4001
Frequent Visitor

Calculating rates between date ranges

Hi everyone,

 

I have a dataset showing items in storage between 2 dates and the charges accumulated for them. The charges occur daily: for example for id 1, we paid $25 on 8/30/2023, $25 on 8/31/2023, $25 on 9/1/2023, etc. I want to be able to calculate total rates for any time frame (i.e. by week / month / year - see desired result table). For id 1, $50 would go towards August 2023 and $75 would go towards September 2023. How could I do this in Power BI Desktop? Please share any DAX code as well. Thank you!

 

current table

idshipdatedepartdatecalendardaysdailyratetotalrate
18/30/20239/3/20235$25$125
27/26/20237/30/20235$20$100
36/26/20237/4/202310$30$300

 

desired result

Time PeriodBilledDaysTotalRate
Jun-235$150
Jul-2310$250
Aug-232$50
Sep-233$75
1 REPLY 1
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1698972988887.png

create a date table

TotalRates = SUMX('YourTable','YourTable'[dailyrate]*COUNTROWS(FILTER(Dates,'Dates'[Date]>='YourTable'[shipdate]&&Dates[Date]<='YourTable'[departdate])))
BillDays = SUMX('YourTable',COUNTROWS(FILTER(Dates,'Dates'[Date]>='YourTable'[shipdate]&&Dates[Date]<='YourTable'[departdate])))

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.