cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

New Member

## 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

1 ACCEPTED SOLUTION
Super User

3 REPLIES 3
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.

New Member

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?

Super User

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors