Forum Discussion
Slow loading visuals / tables
- 1 year ago
Before digging too far into the DAX, I'd recommend looking up and researching field parameters for Power BI: Use report readers to change visuals (preview) - Power BI | Microsoft Learn. It looks like this could solve many problems and simplify the DAX you've made if you implement some date field parameters (Month, Year, Week, etc.). This way, you don't have to calculate each range individually and can just do a single calculation.
Also, try to use the FILTER function with AND or OR to help reduce execution time. var sales_ltm_prev can be re-written as:CALCULATE( [SALES_SUM] , FILTER( VALUES( SALES[WEEK_CONSECUTIVE] ), AND( SALES[WEEK_CONSECUTIVE] >= prv_wknm - 52, SALES[WEEK_CONSECUTIVE] <= prv_wknm ) ) )which could help speed up that query significantly.
Before digging too far into the DAX, I'd recommend looking up and researching field parameters for Power BI: Use report readers to change visuals (preview) - Power BI | Microsoft Learn. It looks like this could solve many problems and simplify the DAX you've made if you implement some date field parameters (Month, Year, Week, etc.). This way, you don't have to calculate each range individually and can just do a single calculation.
Also, try to use the FILTER function with AND or OR to help reduce execution time. var sales_ltm_prev can be re-written as:
CALCULATE(
[SALES_SUM] ,
FILTER(
VALUES(
SALES[WEEK_CONSECUTIVE]
),
AND(
SALES[WEEK_CONSECUTIVE] >= prv_wknm - 52,
SALES[WEEK_CONSECUTIVE] <= prv_wknm
)
)
)
which could help speed up that query significantly.