Forum Discussion

CJ_96601's avatar
CJ_96601
Helper V
6 years ago
Solved

Sum If

Please advise on how to sum all data in two columns if year  is less than or equal to year selection.  Table and calendar has relationship by date.   Below is the same data:     Year BN Bas...
  • CJ_96601's avatar
    CJ_96601
    6 years ago

    Sharing:

     

    This one works:

     

    TotalComp =

       CALCULATE(SUMX(CnB_D,CnB_D[Comp]+CnB_D[Comp1]+CnB_D[Comp2]+CnB_D[Comp3]+CnB_D[Comp4]),


             FILTER (
            ALL ( 'CnB_D'[Hire Date].[Year]),
            'CnB_D'[Hire Date].[Year] <= MAX ( 'zCalendar'[Year])
        )
    )