Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I've been trying, unsuccessfully, to calculate a measure summing up values between two dates. The lower limit date is MIN(Calendar[Date]) while the upper limit should be a dynamic selection from a Date Slicer.
The last two items I've tried are:
MNQ EndBalance = CALCULATE(SUM(Quantities[Value]),DATESBETWEEN('Calendar'[Date],
MIN('Calendar'[Date]),CALCULATE(MIN(Calendar[Date]),ALLSELECTED(Calendar[Date]))))
MNQ EndBalance = CALCULATE(SUM(Quantities[Value]),DATESBETWEEN('Calendar'[Date],
MIN('Calendar'[Date]),SELECTEDVALUE(Calendar[Date]))).
Link to sample file here: BetweenDatesSampleFile
Any suggestions would be highly appreciated.
Thank you.
Solved! Go to Solution.
Try this measure:
MNQ EndBalance =
VAR vStartDate =
MINX ( ALL ( 'Calendar' ), 'Calendar'[Date] )
VAR vEndDate =
MAXX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] )
VAR vResult =
CALCULATE (
SUM ( Quantities[Value] ),
DATESBETWEEN ( 'Calendar'[Date], vStartDate, vEndDate )
)
RETURN
vResult
Proud to be a Super User!
Try this measure:
MNQ EndBalance =
VAR vStartDate =
MINX ( ALL ( 'Calendar' ), 'Calendar'[Date] )
VAR vEndDate =
MAXX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] )
VAR vResult =
CALCULATE (
SUM ( Quantities[Value] ),
DATESBETWEEN ( 'Calendar'[Date], vStartDate, vEndDate )
)
RETURN
vResult
Proud to be a Super User!