Forum Discussion
tracytran91
4 years agoHelper III
Summarize table
Hi friends, I want to create a calculated table using Summarize function which contains "Sales" and "Cost" measure. Sales = CALCULATE(SUM(F_Sales[NetSales]),
TREATAS(VALUES('D_Table'[year...
- 4 years ago
I realized that my sale and cost measure using TREATAS must use the same granularity to make it work.
Anonymous
4 years agoNot applicable
Hello tracytran91
I hope below code works for you.
Summarize_table =
VAR SalesTable =
SUMMARIZE(
D_TABLE,
'D_Table'[year_month],
'D_Table'[customer_no],
"Sales",[Sales]
)
VAR CostTable =
SUMMARIZE(
D_TABLE,
'D_Table'[sup_code],
'D_Table'[year_month],
'D_Table'[Product],
"Cost",[Cost]
)
RETURN
UNION(SalesTable,CostTable)
Thank You.
tracytran91
4 years agoHelper III
Anonymous Thank for your reply.
I gave it a try and UNION function make the column Sales and Cost becomes a "sales" column. It is not my expectation.
- Anonymous4 years agoNot applicable
Hello tracytran91
Could you please share the pbix file after removing the sensitive information?
Thank You.