Forum Discussion
denpries
8 years agoResolver I
Which dax statement is more efficient?
Dear users. I was wondering, while building a piece of DAX, if i could improve it or not. Below is a formula i use to calculate the sales in period 1, starting at P1 start and ending at P1 end...
- 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
Greg_Deckler
8 years agoCommunity Champion
Perhaps:
P1 Sales = VAR tmpDates = FILTER(FILTER(DateTable,DAY([Dates])=1),[Dates]>=[P1 start] && [Dates]<=[P1 end) RETURN SUMX(tmpDates,[Sales])