DAX Measures Library

40+ ready-to-use DAX measures for Power BI.

About this library

Every measure here is a complete, working DAX formula using best practices: VAR/RETURN for readability, DIVIDE instead of / to avoid divide-by-zero errors, and a short comment explaining the tricky parts. Paste one into Power BI's formula bar, swap the placeholder table and column names (like 'Sales'[Amount] and 'Date'[Date]) for your own, and adjust it to fit your model.

Measures marked Advanced usually depend on other measures in this library, or on a properly configured Date table — check the Notes and Requires lines under each one first.

Related tools

Once you've written or adapted a measure, run it through the DAX Formatter to clean up the formatting. Looking for Power Query code instead? Browse the Power Query M Code Library.

Frequently asked questions

What is a DAX measure?

A DAX measure is a calculation, like a sum, ratio or growth rate, that's evaluated on the fly based on whatever filters are currently applied in a Power BI report — a slicer, a row in a table, a date range. Measures don't store any data themselves; they're formulas computed at query time.

Measure vs calculated column: what's the difference?

A calculated column is computed once per row when the data refreshes and is stored in the model, like a regular column. A measure is computed on demand for whatever context a visual currently shows, and recalculates every time a filter changes. Use a calculated column when you need a fixed, row-level value (like a fiscal year label); use a measure for anything that should react to filters and slicers (like a total or a percentage).

Do I need to change anything before pasting these into Power BI?

Yes. Every measure uses placeholder table and column names like 'Sales'[Amount] and 'Date'[Date]. Replace these with your own model's table and column names before using a measure, and check the Notes and Requires lines under each one for anything else it depends on.

Why do some measures reference other measures from this library?

Referencing an existing measure, like [Total Sales], instead of repeating its full formula keeps DAX easier to read and maintain. If a measure's Requires line lists another measure from this library, create that one first, or inline its expression wherever it's referenced.