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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
atallah
Regular Visitor

dax measures for calculating dates

Hello All

 

I am trying to calculate remaining kms that are allowed for using rented car, for example nissan sunny started the rent on 9 oct 2023, and monthly allowance is 2500 km, so by february i have an allowance of 12500 km, so when i dont select year/months my calculation is giving wrong remaining kms

But when am selecting months/year, everything is correct, as shown in snapshot, can anyone tell me what am doing wrong in dax measure

 

monthly used.pngmonthly_filtered.png

1 ACCEPTED SOLUTION

Your calendar table is incomplete

 

lbendlin_0-1708906508797.png

lbendlin_1-1708906765214.png

 

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

hello thanks for reply This is my pbi file https://1drv.ms/u/s!As-fix_XbK9zhHfGq-OLEKAkwxFp?e=Ev6G6h 

Basically what am trying to do is to calculate monthly km used and monthly fuel consumed for this period

For example Nissan sunny rent started on 9 october 2023, and every month on 9th day rent is paid, also allowed kms per months are 2500 km

So from 9 october till 9 november this is 1 months of rental, so on 9th of November I record how many km used, also I have a table for fuel consumption each type I refuel the car with how many liters

So what I want basically for each months to see the km used , but as I record on 9 november, this actually are October kms used as from 9 october to 9 november car was used

And remaining km are “allowed km-km used”

Also how I can write a dax to calculate fuel from 9 october till 9 november?

Also how on my table for november sum of km used should be actually october, how to do that?

Or should i initially change my table?

car_allowance table.pngreport.png

 

Your calendar table is incomplete

 

lbendlin_0-1708906508797.png

lbendlin_1-1708906765214.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.