Forum Discussion

Peter_2020's avatar
Peter_2020
Icon for Helper III rankHelper III
3 years ago
Solved

SUM with specific filter 2

Hi all, 

I would like to ask you for help with following situation: I have this table with lot of different PO´s. The issue I will explain you on one PO like an example:

As you can see each PO have specific Operation and Code - 01 - assigned to hours and 20 - assigned to quantity. And what I need to achieve is to get for each PO, OPERATION and RC SUM of the hours and quantity in each row. It must look like this:

 

 

 

Any idea how to achieve this?

Thank you in advance. 

P.

  • OK, try

    Sum hours =
    CALCULATE (
        SUM ( 'Table'[Hours] ),
        ALLEXCEPT ( 'Table', 'Table'[PO], 'Table'[Operation] )
    )
    

4 Replies

  • Try

    Sum hours =
    VAR SummaryTable =
        SUMMARIZE ( 'Table', 'Table'[PO], 'Table'[Operation], 'Table'[RC] )
    VAR Result =
        CALCULATE ( SUM ( 'Table'[Hours] ), SummaryTable )
    RETURN
        Result
    
    • Peter_2020's avatar
      Peter_2020
      Icon for Helper III rankHelper III

      Hi johnt75 , 

      thank you for your reply. It calculate the sum of the hours but it is split by the RC number what is wrong:

      What I need is to get the sum of all hours for specific PO  and Operation to both lines with RC number. 

      P. 

       

  • OK, try

    Sum hours =
    CALCULATE (
        SUM ( 'Table'[Hours] ),
        ALLEXCEPT ( 'Table', 'Table'[PO], 'Table'[Operation] )
    )