cancel
Showing results for
Did you mean:
Helper I

Dax Optimization - Formula Improvement Help

Can someone help me optimize this first part of my Meausre? It has to be dynamic which is why I have to do it in a measure. The first thing I have to do is take my "Date_Date" column and for each date join with 60 days of invoicing. That is what the code below is doing but it is super slow. Any suggestions on how to speed it up? So a small example of my "virtual" table in dax would be this. Any help would be greatly apprciated.

 1/1/2021 1/1/2021 1/1/2021 1/2/2021 1/1/2021 1/3/2021 1/1/2021 1/4/2021 1/2/2021 1/2/2021 1/2/2021 1/3/2021 1/2/2021 1/4/2021 1/2/2021 1/5/2021

GENERATE (
SELECTCOLUMNS (
CALCULATETABLE (
VALUES ( 'Date'[Date_Date] ),
FILTER (
ALL ( 'Date'[Date_Invoicing_Day_FLG] ),
'Date'[Date_Invoicing_Day_FLG] = 1
),
CROSSFILTER ( 'Date'[Date_Key], 'Sales Order Table'[Created Date Key], BOTH )
),
"Help", 'Date'[Date_Date]
),
CALCULATETABLE (
VALUES ( 'Date'[Date_Date] ),
FILTER (
ALL ( 'Date'[Date_Date], 'Date'[Date_Invoicing_Day_FLG] ),
'Date'[Date_Date]
<= EARLIER ( [Help] ) + 60
&& 'Date'[Date_Date] >= EARLIER ( [Help] )
&& 'Date'[Date_Invoicing_Day_FLG] = 1
)
)
)
1 ACCEPTED SOLUTION
Community Support

Hi, @noahh

According to your DAX formula, you used the table operation functions like “GENERATE”, “CROSSFILTER”,” Filter”, which will work for each row the measure is calculated. I think this will take plenty of time if the data amount is very large.

Maybe you can avoid generating virtual tables more than once to speed up the calculation of the measure if it’s possible. It’s also feasible if you can use the entity table to replace some of the virtual tables. You can also refer to this document to get some suggestions for improving Power BI Performance by Optimizing DAX:

https://maqsoftware.com/expertise/powerbi/dax-best-practices

Thank you very much!

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support

Hi, @noahh

According to your DAX formula, you used the table operation functions like “GENERATE”, “CROSSFILTER”,” Filter”, which will work for each row the measure is calculated. I think this will take plenty of time if the data amount is very large.

Maybe you can avoid generating virtual tables more than once to speed up the calculation of the measure if it’s possible. It’s also feasible if you can use the entity table to replace some of the virtual tables. You can also refer to this document to get some suggestions for improving Power BI Performance by Optimizing DAX:

https://maqsoftware.com/expertise/powerbi/dax-best-practices

Thank you very much!

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements