Forum Discussion
EWBWEBB
Helper III
3 years agoUSERELATIONSHIP ERROR - breaking results
I am trying to count the number of cases closed and logged in a date range using a DimDate calendar in my slicer. DimDate is a Simple calendar table Date,DateKey,Day,Month,Year I then have a...
- 3 years ago
Try this one:
VAR MinDate = MIN(Central_Tracker[DateClosedKey]) VAR MaxDate = MAX(Central_Tracker[DateClosedKey]) VAR Result = CALCULATE( COUNTROWS(Central_Tracker), USERELATIONSHIP(Central_Tracker[DateClosedKey],DimDate[DateKey]), FILTER(DimDate, DimDate[DateKey] >= MinDate && DimDate[DateKey] <= MaxDate ) ) RETURN Result
Uspace87
Resolver III
3 years agoTry this one:
VAR MinDate = MIN(Central_Tracker[DateClosedKey])
VAR MaxDate = MAX(Central_Tracker[DateClosedKey])
VAR Result =
CALCULATE(
COUNTROWS(Central_Tracker),
USERELATIONSHIP(Central_Tracker[DateClosedKey],DimDate[DateKey]),
FILTER(DimDate,
DimDate[DateKey] >= MinDate &&
DimDate[DateKey] <= MaxDate
)
)
RETURN
ResultEWBWEBB
Helper III
3 years agoAmazing, thank you this has worked but I don't get why?
In my head having the Variables as minimum and maximum date pulled from the central tracker doesn't make sense as I want the Min & Max date from the date table filter and then all closed dates that fall between this.
Any chance you can entertain me and explain why this works?