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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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