Forum Discussion

sambgv's avatar
sambgv
Helper I
2 years ago
Solved

Adding sums from two measures

Classification  Team Role  Date Value ID_ X A Mechanic 07-Feb 1 A_Mechanic_Feb X B Fireman 07-Feb 1 B_Fireman_Feb X C Doctor 07-Feb 1 C_Doctor_Feb X Pool Baker 0...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  sambgv ,

     

    Here are the steps you can follow:

    1. Create measure.

    Question1 =
    var _SupplyTable=
    SUMX(FILTER(ALL('Supply Table'),YEAR('Supply Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Supply Table'[Date])=MONTH(MAX('Supply Table'[Date]))&&'Supply Table'[Team]<>"Pool"),[Value])
    var _DemandTable=
    SUMX(FILTER(ALL('Demand Table'),YEAR('Demand Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Demand Table'[Date])=MONTH(MAX('Supply Table'[Date]))),[Value])
    return
    _SupplyTable - _DemandTable
    Question2 =
    SUMX(FILTER(ALL('Supply Table'),YEAR('Supply Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Supply Table'[Date])=MONTH(MAX('Supply Table'[Date]))&&'Supply Table'[Team]="Pool"),[Value])
    Question3 =
    var _Pool=
    SUMX(
        FILTER('Supply Table',[Team]="Pool"),[Value])
    var _Supply=
    SUMX(
        'Supply Table',[Value])
    var _Demand=
    SUMX(  
        FILTER('Demand Table',
        YEAR('Demand Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Demand Table'[Date])=MONTH(MAX('Supply Table'[Date]))),[Value])
    return
    _Pool + (_Supply - _Demand)

    2. Result:

     

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly