Forum Discussion

MarcW's avatar
MarcW
Frequent Visitor
3 years ago
Solved

Userrelationship / ParrallelPeriod wrong subtotals

Hi all,   I have a problem with wrong subtotals in my calculations using Userrelationship / ParrallelPeriod. The fact table contains cost information per employee and two date columns, date and so...
  • MarcW's avatar
    MarcW
    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.