Forum Discussion
DAX HELP Multi Sumx alternative?
- 9 years ago
Anonymous
Thanks for that :)
You will have to change the measure if there are multiple fact tables involved.
I have two ideas:
- Use SUMX with SUMMARIZECOLUMNS. SUMMARIZECOLUMNS doesn't require you to specify the table to be summarized, and if you add a column with an expression, it will automatically remove rows where the expression is blank.
(Side note: SUMMARIZECOLUMNS didn't previously work within a filter context, but now it appears to work. Interesting article here)PnL SUMMARIZECOLUMNS = SUMX ( SUMMARIZECOLUMNS ( 'CALENDAR'[DATE], HE[HE], CTRL[CTRL], DataClass[ZONE], "ExpressionToSum", ( [INCS MWH] + [DECS MWH (neg)] ) * [DART Spread] + [DEV Cost INCS] + [DEV Cost DECS] ), [ExpressionToSum] ) - Use the SUMMARIZE method with multiple fact tables by SUMMARIZE-ing each table and take the union.
PnL SUMMARIZE Union = VAR BIDS_Summarized = SUMMARIZE ( BIDS, 'CALENDAR'[DATE], HE[HE], CTRL[CTRL], DataClass[ZONE] ) VAR LMP_Summarized = SUMMARIZE ( LMP, 'CALENDAR'[DATE], HE[HE], CTRL[CTRL], DataClass[ZONE] ) VAR DEV_Summarized = SUMMARIZE ( LMP, 'CALENDAR'[DATE], HE[HE], CTRL[CTRL], DataClass[ZONE] ) VAR Union_Summarized = DISTINCT ( UNION ( BIDS_Summarized, LMP_Summarized, DEV_Summarized ) ) RETURN SUMX ( Union_Summarized, ( [INCS MWH] + [DECS MWH (neg)] ) * [DART Spread] + [DEV Cost INCS] + [DEV Cost DECS] )
I think the SUMMARIZECOLUMNS version should perform best, but would be interested in how actual performance turns out.
Cheers,
Owen :)
- Use SUMX with SUMMARIZECOLUMNS. SUMMARIZECOLUMNS doesn't require you to specify the table to be summarized, and if you add a column with an expression, it will automatically remove rows where the expression is blank.
I have to question your overall approach. What are you trying to achieve overall by using this?
Would you be better having a simple Sum measure (not SUMX), then making use of the Power BI Reporting engine to display that data hourly? Surely if you've linked your tables correctly you should be able to display this data in either a graph or a matrix with the granularity you need.
I'm with Ross, you have GOT to be off in the weeds here.
Maybe show us what is inside your the base measure that are used inside the quad-sumx?