Forum Discussion

Yonko's avatar
Yonko
Icon for Helper I rankHelper I
3 years ago
Solved

How to get total value?

Hi there. This is my problem - there is a table with project names, tasks and time (for simplicity there is only 1 project). Each project may have different tasks, and each tasks will take different ...
  • v-jianboli-msft's avatar
    3 years ago

    Hi Yonko ,

     

    Based on your description, I have creeated a simple sample:

    Please try:

     

    Time = 
    VAR _a =
        SUM ( 'Table (2)'[Time] )
    VAR _b =
        SELECTCOLUMNS (
            FILTER ( ALL ( 'Table' ), [Project] = MAX ( 'Table'[Project] ) ),
            "Task", [Task]
        )
    VAR _c =
        SUMX ( FILTER ( ALL ( 'Table (2)' ), [Task] IN _b ), [Time] )
    RETURN
        IF ( MAX ( 'Table'[Task] ) = "Total", _c, _a )

     

    Final output:

    Best Regards,

    Jianbo Li

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