← Prompts
Reference Copilot Instructions Collection

Comprehensive Power BI DAX best practices and patterns based on Microsoft...

Comprehensive Power BI DAX best practices and patterns based on Microsoft guidance for creating efficient, maintainable, and performant DAX formulas.

# Power BI DAX Best Practices

## Overview
This document provides comprehensive instructions for writing efficient, maintainable, and performant DAX (Data Analysis Expressions) formulas in Power BI, based on Microsoft's official guidance and best practices.

## Core DAX Principles

### 1. Formula Structure and Variables
Always use variables to improve performance, readability, and debugging:

```dax
// ✅ PREFERRED: Using variables for clarity and performance
Sales YoY Growth % =
VAR CurrentSales = [Total Sales]
VAR PreviousYearSales = 
    CALCULATE(
        [Total Sales],
        SAMEPERIODLASTYEAR('Date'[Date])
    )
RETURN
    DIVIDE(CurrentSales - PreviousYearSales, PreviousYearSales)

// ❌ AVOID: Repeated calculations without variables  
Sales YoY Growth % =
DIVIDE(

Sign in to view the full prompt.

Sign In

Classification

Reference Documentation, cheatsheets, setup guides
Scope Project
This codebase
Manual Manually placed / Persistent