Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Summing with filter changing each row

My data does not have a correct value for the highest level in the hierachy. The value should be calculated based on all the values belonging to the same main project.   I can calculate this in Exc...
  • Anonymous's avatar
    Anonymous
    6 years ago

    That did not work correctly. It gives the same value for each row. But luckily I managed to figure out a way to do it. Below table contains both calculations. Correct one in CALC and your suggestion in Measure.

     

     

    CALC = SUMX(
        FILTER(
            'Table'; 
            'Table'[Main project] == EARLIER('Table'[Project number]) || 
            'Table'[Project number] == EARLIER('Table'[Project number])
            ); 
        'Table'[Value]
    )

     

     

    Main projectProject numberValueCALCMeasure
    AA0-237700-59819198,68
    AA1-134100-134100-59819198,68
    AA2-103600-103600-59819198,68
    BB15000-1864449,97-59819198,68
    BB1-338250-338250-59819198,68
    BB2-451699,98-451699,98-59819198,68
    BB3-418999,74-418999,74-59819198,68
    BB4-670500,25-670500,25-59819198,68
    CC0-2013599,94-59819198,68
    CC1-338250-338250-59819198,68
    CC2-451699,98-451699,98-59819198,68
    CC3-418999,98-418999,98-59819198,68
    CC4-804649,98-804649,98-59819198,68
    DD0-789949,98-59819198,68
    DD1-338250-338250-59819198,68
    DD2-451699,98-451699,98-59819198,68