Forum Discussion

francescjp's avatar
francescjp
Regular Visitor
2 years ago

Sum values with condition from diferent tables

Hello:

 

I have 12 tables, each for one month. Here you have an example of two months. In the first column I have name and surname of each person. In following columns, I have different concepts that have earned all the days in the month. There was an additional day row that has been hidden. This is the reason because concepts are repeated en each month. Each one was earned in different day.

I need to sum the total of year of each concept per person. The conpcets can be different in each month. Anyobody knows how to calculate it?

 

Thanks in advance.

 

An example:

 

The desired result:

Year

 Junta Govern LocalComissió Interàrees
Person 1XXXYYY
Person 2ZZZZKKKK

 

Data I have:

 

January

 Junta Govern LocalComissió InteràreesComissió InteràreesConsell Escolar MpalJunta Govern LocalComissió InteràreesComissió Informativa PJunta de PortaveusComissió InteràreesConsell Comerç i ConsumJunta Govern Local EPle
Person161.48ABSENTABSENTnull61.48ABSENT112.7null175.24null61.48276.62
Person2null175.24175.24nullnull175.24112.7null175.24112.7null276.62
Person361.48175.24175.24null61.48175.24112.7null175.24null61.48276.62
Person461.48ABSENT175.24112.761.48ABSENTABSENT61.48175.24null61.48276.62
Person5null175.24175.24nullnull175.24112.7null175.24nullnull276.62
Person6nullnullnullnullnullnull112.761.48nullnullnull276.62
Person7nullnullnullnullnullnull112.7nullnullnullnull276.62
Person8nullnullnullnullnullnull112.7nullnullnullnull276.62
Person9nullnullnull112.7nullnull112.7nullnull112.7null276.62
Person10nullnullnullnullnullnull112.7nullnullnullnull276.62
Person1161.48175.24175.24112.761.48175.24112.761.48175.24nullABSENT276.62
Person12null175.24175.24nullnull175.24112.7null175.24112.7null276.62
Person13nullnullnullnullnullnull112.7nullnullnullnull276.62
Person14nullnullnull112.7nullnull112.761.48null112.7null276.62
Person15nullnullnull112.7nullnull112.761.48null112.7null276.62

 

 

February

Cognoms i nomJunta Govern LocalComissió InteràreesComissió InteràreesJunta Govern LocalComissió Informativa PComissió InteràreesJunta de PortaveusPleComissió Interàrees
Person161.48175.24175.2461.48112.7175.24null276.62175.24
Person2null175.24175.24null112.7175.24null276.62175.24
Person361.48175.24175.2461.48112.7175.24null276.62175.24
Person1561.48175.24175.2461.48112.7175.2461.48276.62175.24
Person18null175.24175.24null112.7175.24null276.62175.24
Person19nullnullnullnull112.7nullABSENT276.62null
Person20nullnullnullnull112.7nullnull276.62null
Person5nullnullnullnull112.7nullnull276.62null
Person6nullnullnullnull112.7nullnull276.62null
Person7nullnullnullnullABSENTnullnull276.62null
Person861.48175.24175.2461.48112.7175.2461.48276.62175.24
Person9null175.24175.24null112.7175.24null276.62175.24
Person10nullnullnullnull112.7nullnull276.62null
Person11nullnullnullnull112.7null61.48276.62null
Person12nullnullnullnull112.7null61.48276.62null

1 Reply

  • Daniel29195's avatar
    Daniel29195
    Icon for Community Champion rankCommunity Champion

    Hello  francescjp ,

    i would suggest at first to unpivot the 12 tables : 

    example  of unpivoting a table : 

     

     

    after unpivoting : 

     

     

     

    after you unpivot all tables, the next step is to append tables  ( use append query in the power query ) . 

     

     

    third step : 

    create a matrix with concept on the columns and person on the rows  and aggregation on values .

     

    hope this helps