Convert ADDCOLUMNS + SUMMARIZE to SUMMARIZECOLUMNS
I'm attempting some performance tuning with a complex dax calculation and my research has lead me to the use of SUMMARIZECOLUMNS over SUMMARIZE + ADDCOLUMNS.
I was able to accurately calculate average daily sales units over a 6 week period (dropping the high and low week of sales. however, when using this calculation it wrecks my performance. My fact table is named "CONFORM_MOVEMENT" it has about 2.5 million records.
In the image below you can see the variable values_displayed where I calculate the base table. I'm summarizing the daily sales units and time period by Store, Item.
The daily sales units are then used for determining the max and minimum of the 6 week period. Using the additional @Time_period_end column I'm able to determine which week is high and low and then calculate the average where it doesn't equal.
I attempted to convert this to a SUMMARIZECOLUMNS table however I keep getting the error: SummarizeColumns() and AddMissingItems() may not be used in this context. --See variable values_displayed1
Due to the complexity of SUMMARIZECOLUMNS I'd strongly advise against using it in complicated scenarios. Its behaviour is highly unintuitive (meaning you'll be getting figures you won't know how to explain in no time) and the function also has bugs (yes, you heard it right). If you want to know what I'm really talking about, you can have a read of this article by my colleague: The Peculiar Behavior Of SUMMARIZECOLUMNS In DAX | LinkedIn
There's even much more to what Abhinav is talking about in his article but discussing it would take quite a time. By the way, the error you get is very likely a manifestation of what I'm talking about here. I've had such situations in the past as well (getting the same error) and it was not possible to pinpoint what the problem was.