Forum Discussion
ziqh
8 years agoFrequent Visitor
Summarising rows in calculated table
Hi All, Stuck on an issue that I'm almost certain is a simple one. I have two tables of data, and I've taken them to a single calculated table via a UNION, like so: CalcTable = UNION( ...
Anonymous
8 years agoNot applicable
Something like this should work for you.
Calc_table= VAR inTempTable= UNION(
SELECTCOLUMNS(Table1, "ID", [ID], "Qty A", [Quantity], "Qty B", 0),
SELECTCOLUMNS(Table1, "ID", [ID], "Qty A", 0, "Qty B", [Quantity])
)
RETURN
SUMMARIZE ( inTempTable, inTempTable[ID],"Total Qty A",SUM(inTempTable[QtyA]),"Total QtyB",SUM(inTempTable[QtyB]))
Thanks
Raj
ziqh
8 years agoFrequent Visitor
Hi Raj, thanks for the help.
I've tried the suggested, but when attempting to SUM(inTempTable[QtyA]), PowerBI refuses.
Error:
Table variable "inTempTable" cannot be used in this context because a base table is expected.
The only fields it gives me access to in the SUM() are from other tables.
Thanks.