Forum Discussion
ddalton
4 years agoResolver I
Create new table that sums rows based on matching column value
I have a table containing data with columns containing a reference (non-unique) and a type (non-unique). A representation is below: TableA Reference Type Value A123 Type1 5521 A123 ...
- 4 years ago
ddalton create this calculated table:
TableB = ADDCOLUMNS( VALUES('TableA'[Reference]), "Type1", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type1"), "Type2", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type2") )
ddalton
4 years agoResolver I
Ah. No, there is more than one reference per customer. I've updated the original reply above to include, for example, reference C231 and show that is also linked to Cust AAA.
So, there is multiple references per customer.
SpartaBI
4 years agoCommunity Champion
ddalton you mean like this? :
TableB =
ADDCOLUMNS(
ALL('TableA'[Reference], TableA[Cust]),
"Type1", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type1"),
"Type2", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type2")
)
- ddalton4 years agoResolver I
Exactly like that. Thank you!
- SpartaBI4 years agoCommunity Champion
ddalton my pleasure 🙂
Don't forget about the report please 🤣.
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
Give it a thumbs up over there if you liked it 🙂