Forum Discussion
Get sum based on multiple column group/filter
- 8 years ago
You need to rename those column in tables to ensure that all the columns name are the same on each table, and then append those queries in Query Editor.
Then create a new table by using the DAX.
Table = SUMMARIZE(Table1,Table1[Type],"TotalCost",CALCULATE(SUM(Table1[Cost]),ALLEXCEPT(Table1,Table1[Type])))
Regards,
Charlie Liao
It's hard to understand your requirement based on your description and sample data. We cannot understand the relations between repaircost and invoice. So please elaborate it, so that we can make further analysis.
Regards,
Charlie Liao
- ApurvaKhatri8 years agoHelper III
Type1 Cost1
0 100
1 400
3 600
5 800
6 200
7 1000
Type2 Cost2
1 500
2 1200
5 500
6 200
Type3 Cost3
5 100
6 100
7 400
Now, I want to sum(cost1) + sum(cost2) + sum(cost3) but i want only 1 column of type. ( I want all the distinct values in a column of types and sum all cost based on types)
Output Table:
Type(combine type 1,type 2, type 3 into one column) Cost (sum all three costs based on value in column)
0 100
1 900 (sum((cost 1) + cost2)))
2 1200
3 600
5 1400 (cost 1 + cost2 + cost3)
6 500 (cost 1 + cost2 + cost3)
7 1400 (cost1 + cost3)
Thank you.
- v-caliao-msft8 years agoMicrosoft Employee
You need to rename those column in tables to ensure that all the columns name are the same on each table, and then append those queries in Query Editor.
Then create a new table by using the DAX.
Table = SUMMARIZE(Table1,Table1[Type],"TotalCost",CALCULATE(SUM(Table1[Cost]),ALLEXCEPT(Table1,Table1[Type])))
Regards,
Charlie Liao