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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

If today is between two dates, calculate cost

I have a table, where i want to create a measure in DAX which calculate the cost of the items only if both of the two conditions are met, when today is after or equal to the pick up date and when today is less than or equal to the drop off date. I am not getting the right answer, could someone please advice.

 

itemsPick up dateDrop off datecost
101/01/202403/01/2024£5
202/01/202407/01/2024£10
303/01/202410/01/2024£15
1 ACCEPTED SOLUTION
AnkitaaMishra
Super User
Super User

Hi @Anonymous ,

Could you please try below DAX to create a measure : 

Total Cost =
SUMX(
    FILTER(
        'Table',
        TODAY() >= 'Table'[Pick up date] &&
        TODAY() <= 'Table'[Drop off date]
    ),
    'Table'[cost]
)
 
Let me know if this works for you.
Thanks,
Ankita

View solution in original post

1 REPLY 1
AnkitaaMishra
Super User
Super User

Hi @Anonymous ,

Could you please try below DAX to create a measure : 

Total Cost =
SUMX(
    FILTER(
        'Table',
        TODAY() >= 'Table'[Pick up date] &&
        TODAY() <= 'Table'[Drop off date]
    ),
    'Table'[cost]
)
 
Let me know if this works for you.
Thanks,
Ankita

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors