Forum Discussion

atallah's avatar
atallah
Regular Visitor
2 years ago
Solved

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

 

3 Replies

  • 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-Forum/ba-p/963216

    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/1447523

    • atallah's avatar
      atallah
      Regular Visitor

      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?

       

      • lbendlin's avatar
        lbendlin
        Super User

        Your calendar table is incomplete