Loading...
Loading...
Comprehensive Power BI DAX formula optimization prompt for improving performance, readability, and maintainability of DAX calculations.
npx skill4agent add github/awesome-copilot power-bi-dax-optimizationAnalyze the provided DAX formula and identify:
- Performance bottlenecks
- Readability issues
- Best practice violations
- Potential errors or edge cases
- Maintenance challengesDevelop optimization approach:
- Variable usage opportunities
- Function replacements for performance
- Context optimization techniques
- Error handling improvements
- Structure reorganizationProvide the improved DAX formula with:
- Performance optimizations applied
- Variables for repeated calculations
- Improved readability and structure
- Proper error handling
- Clear commenting and documentationExplain all changes made:
- Performance improvements and expected impact
- Readability enhancements
- Best practice alignments
- Potential trade-offs or considerations
- Testing recommendations/*
ORIGINAL FORMULA ANALYSIS:
- Performance Issues: [List identified issues]
- Readability Concerns: [List readability problems]
- Best Practice Violations: [List violations]
OPTIMIZATION STRATEGY:
- [Explain approach and changes]
PERFORMANCE IMPACT:
- Expected improvement: [Quantify if possible]
- Areas of optimization: [List specific improvements]
*/
-- OPTIMIZED FORMULA:
Optimized Measure Name =
VAR DescriptiveVariableName =
CALCULATE(
[Base Measure],
-- Clear filter logic
Table[Column] = "Value"
)
VAR AnotherCalculation =
DIVIDE(
DescriptiveVariableName,
[Denominator Measure]
)
RETURN
IF(
ISBLANK(AnotherCalculation),
BLANK(), -- Preserve BLANK behavior
AnotherCalculation
)Sales Growth = ([Total Sales] - CALCULATE([Total Sales], PARALLELPERIOD('Date'[Date], -12, MONTH))) / CALCULATE([Total Sales], PARALLELPERIOD('Date'[Date], -12, MONTH))