Forum Discussion
Which dax statement is more efficient?
- Anonymous8 years ago
denpries,
In your original post, the P1 Sales* will be more efficient than P1 Sales, and it executes faster than P1 Sales. The DAX Greg_Deckler provides will spend more time to execute comparing with your original measures.
You can use SQL Server Profiler to check the query duration and DAX query plan for these measures and verify the whole process. There are some blogs for your reference.
https://insightsquest.com/2017/05/07/profiler-trace-for-power-bi-desktop/
https://www.sqlbi.com/wp-content/uploads/DAX-Query-Plans.pdf
Regards,
Lydia
Perhaps:
P1 Sales = VAR tmpDates = FILTER(FILTER(DateTable,DAY([Dates])=1),[Dates]>=[P1 start] && [Dates]<=[P1 end) RETURN SUMX(tmpDates,[Sales])
- denpries8 years agoResolver I
Greg_Deckler that also works, yes. If i understand it correctly you filter from the dates table all applicable rows (so basically 1 per month) and then sumx evaluates the [sales] for every row of that table and adds it together.
What i dont understand yet, and try to know why, if this approach is more efficient then the other.- denpries8 years agoResolver I
Anybody else with an opinion about this / some more in depth knowledge?
- Anonymous8 years agoNot applicable
denpries,
In your original post, the P1 Sales* will be more efficient than P1 Sales, and it executes faster than P1 Sales. The DAX Greg_Deckler provides will spend more time to execute comparing with your original measures.
You can use SQL Server Profiler to check the query duration and DAX query plan for these measures and verify the whole process. There are some blogs for your reference.
https://insightsquest.com/2017/05/07/profiler-trace-for-power-bi-desktop/
https://www.sqlbi.com/wp-content/uploads/DAX-Query-Plans.pdf
Regards,
Lydia