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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors