I have created two measures minCheck
and maxCheck
, one to check the minimum date a campaign started and another to check the maximum date of the campaign.
I also have a date slicer from the calendar table, what I want to do is count how many days between minCheck
and maxCheck
consists within the date slicer.
So the date filtered is 27/06/2022 - 25/06/2023
, so I need to return only the count of days that are within the selected date range which would be 96 days because 22/03/203 - 25/06/2023
minCheck =
var minCheck = CALCULATE(MIN('Range Plan Table'[valid_from]), USERELATIONSHIP('Overview Table'[campaignStartDate], 'Range Plan Table'[range_plan_date]))
RETURN minCheck
maxCheck =
var maxCheck = CALCULATE(MAX('Range Plan Table'[valid_to]),USERELATIONSHIP('Overview Table'[campaignStartDate], 'Range Plan Table'[range_plan_date]))
RETURN maxCheck
Hoping I understood correctly, try:
My Measure Days =
var slicerS = MIN('Calendar'[Date])
var slicerE = MAX('Calendar'[Date])
return
DATEDIFF(
MAX(slicerS, [minCheck]),
MIN(slicerE, [maxCheck]),
DAY
)