27.5 DAX Best Practices
- Measures over calculated columns for aggregations – measures are computed only when needed and take no storage.
- Use variables to avoid calculating the same expression twice.
- Use DIVIDE instead of
IF(denominator = 0, …)patterns. - Filter columns, not tables:
CALCULATE([Total Sales], Product[Category] = "Snacks")rather thanFILTER(Orders, RELATED(Product[Category]) = "Snacks"). - Avoid iterating large tables with complex row-by-row logic when a simple aggregation works.
- Reduce use of
FORMATin measures that feed large tables. - Return BLANK instead of 0 where appropriate – visuals then skip empty combinations rather than showing thousands of zero rows.
Ravindra Bagale's Tip
A common DAX performance mistake is using FILTER over an entire fact table, and repeating sub-expressions. Use column filters inside CALCULATE, store repeated values in variables, and prefer DIVIDE. Test a slow measure in DAX Studio to see the server timings. It's very simple – just make it a habit.
Ravindra Bagale's Tip – मराठी
DAX performance मधली एक common चूक म्हणजे संपूर्ण fact table वर FILTER वापरणं, आणि तेच sub-expressions पुन्हा पुन्हा लिहिणं. CALCULATE मध्ये column filters वापरा, वारंवार लागणाऱ्या values variables मध्ये साठवा, आणि DIVIDE वापरा. Slow measure DAX Studio मध्ये test करून server timings बघा. एकदम simple आहे, फक्त सवय लावून घ्या.
Ravindra Bagale's Tip – हिंदी
DAX performance की एक common गलती है पूरी fact table पर FILTER इस्तेमाल करना, और वही sub-expressions बार-बार लिखना. CALCULATE के अंदर column filters इस्तेमाल करो, बार-बार आने वाली values को variables में रखो, और DIVIDE इस्तेमाल करो. Slow measure को DAX Studio में test करके server timings देखो. बहुत आसान है, बस आदत बना लो.