Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Power BI Community,
I'm working on a report that requires summing quantities over a specified date range for each supplier. Here are the details:
Tables Involved:
Objective: For each supplier, I need to calculate the total quantity from the DEHIRE_LOGS table for a range of dates defined by the selected date in the slicer minus the allowance days from the DWELL_TIMES table.
Example: If the selected date in the slicer is 17/06/2024 and the allowance is 8 days, the date range should be from 09/06/2024 to 17/06/2024. The measure should sum the QUANTITY from the DEHIRE_LOGS table for this date range.
Steps Taken:
Created a measure to calculate the start date:
Created a measure to sum the quantities over the date range:
Issue: Despite the steps above, the measure only shows the QUANTITY for the selected date, not the sum over the specified date range.
Solved! Go to Solution.
Hi @SzymonKl
I made some changes to your code:
Measure =
var selectDate = SELECTEDVALUE('Calendar'[Date])
var Allowance = MAX('Dwell_Times'[Allowance])
var startDate = selectDate - Allowance
RETURN
CALCULATE(
SUM('Dehire_logs'[Quantity]),
FILTER(
ALLSELECTED('Dehire_logs'[Dehired_AT]),
'Dehire_logs'[Dehired_AT] >= startDate
&&
'Dehire_logs'[Dehired_AT] <= selectDate
)
)
If you still have problems, it is best to provide the pbix file and be careful to delete sensitive data.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @SzymonKl
I made some changes to your code:
Measure =
var selectDate = SELECTEDVALUE('Calendar'[Date])
var Allowance = MAX('Dwell_Times'[Allowance])
var startDate = selectDate - Allowance
RETURN
CALCULATE(
SUM('Dehire_logs'[Quantity]),
FILTER(
ALLSELECTED('Dehire_logs'[Dehired_AT]),
'Dehire_logs'[Dehired_AT] >= startDate
&&
'Dehire_logs'[Dehired_AT] <= selectDate
)
)
If you still have problems, it is best to provide the pbix file and be careful to delete sensitive data.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 9 | |
| 8 | |
| 6 | |
| 6 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 18 | |
| 14 | |
| 14 |