Forum Discussion
Userrelationship / ParrallelPeriod wrong subtotals
- 3 years ago
Thanks for getting back to me. Unfortunately that was not working for me. In the meantime I did get help in another forum. My code missed a REMOVEFILTERS condition. Then it works fine:
MaxSourcedate =
VAR CY = 0
VAR Source =
CALCULATE(
MAX( WorkDay[SourceDate] ),
USERELATIONSHIP( WorkDay[SourceDate], 'Date'[Date] ) ,
PARALLELPERIOD('Date'[Date], CY, YEAR) ,REMOVEFILTERS ( 'WorkDay' )
)
VAR Result =
CALCULATE(
[Annual Pay],
FILTER(
ALL(WorkDay[SourceDate]),
WorkDay[SourceDate] = Source
)
)RETURN
Result
Thanks a lot anyway.
MarcW , Try like
Var _measure = CALCULATE(
[Annual Pay] ,USERELATIONSHIP( WorkDay[SourceDate], 'Date'[Date] ) )
VAR Result =
CALCULATE(
_measure,
Dateadd('Date'[Date], -1, year)
)
Have measure with userelationship and then use time intelligence
Check the last period formula in my Hr file, attached after signature
Thanks for getting back to me. Unfortunately that was not working for me. In the meantime I did get help in another forum. My code missed a REMOVEFILTERS condition. Then it works fine:
MaxSourcedate =
VAR CY = 0
VAR Source =
CALCULATE(
MAX( WorkDay[SourceDate] ),
USERELATIONSHIP( WorkDay[SourceDate], 'Date'[Date] ) ,
PARALLELPERIOD('Date'[Date], CY, YEAR) ,
REMOVEFILTERS ( 'WorkDay' )
)
VAR Result =
CALCULATE(
[Annual Pay],
FILTER(
ALL(WorkDay[SourceDate]),
WorkDay[SourceDate] = Source
)
)
RETURN
Result
Thanks a lot anyway.