Skip to main content
Microsoft Idea

Power BI

Needs Votes

DAX Measure Templates

Vote (39) Share
Douglas Day's profile image

Douglas Day on 22 May 2015 20:17:04

I'd like the ability to create measure templates. Where I could define a DAX calculation and then specify variables in the calculation that I could replace.

I pick the template I wont to use, am prompted to replace the variables and then the actual measure gets created in the model.

It would feel a bit like the funcationality in SQL Management Studio when you can use the "specify values for template parameters" option on a SQL script.

A typical use case would be when creating time intelligence calculations, the calculations all follow the same pattern, it's just the measure that I'm using changes.

Overtime you would be able to create a library of templates that you can use across various different models. This would definitely speed up the development process.

Comments (3)
Douglas Day's profile image Profile Picture

N G on 14 Dec 2021 13:44:42

RE: DAX Measure Templates

I would love to be able to share our standard enterprise model measure logic with our citizen developers. Sometimes, they need to replicate small parts of our main BI model in their own projects.

We would need to be able to parameterize field references and show measure dependency chain.

Pulling in the entire model through shared dataset composite models is often overkill if just targeting one or two measures, and it's hard for users to know which tables they need to support the measure in the first place.

Douglas Day's profile image Profile Picture

James on 05 Jul 2020 22:41:01

RE: DAX Measure Templates

It would be helpful to have native support for common DAX patterns (e.g. http://www.daxpatterns.com/time-patterns/) to avoid the tedium of generating DAX by hand. Support for this feature would evolve beyond implicit measures to implicit measure groups. Many financial dashboards take advantage of period comparisons and it gets to be very tiresome to have to recreate MTD, QTD, YTD, YOY, etc. for each iteration of an implicit measure.

Many of the simple measures like SUMX(Sales,[Sales Amount]) represent the tip of the iceberg for more involved reports and dashboards. Template/Pattern support would help to accelerate development time for analysts. Many of my coworkers struggle with DAX concepts and the patterns that Marco Russo and others have documented would benefit from automation support.

Some models get to be pretty tediuous from all of the hand coding of DAX with the same patterns. Templates and bulk measure editing are related, so please see these other, related ideas:

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/17554678-bulk-editing-for-columns-measures-in-pbi-desktop

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/11342637-ability-to-delete-multiple-measures-at-one-time-in

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/13219620-duplicate-measure-and-format-copy

Douglas Day's profile image Profile Picture

marian on 05 Jul 2020 22:12:26

RE: DAX Measure Templates

I would also appreciate default measures. For technical users it is ismple to write DAX measure. But for business users it is much more convenient to use default measure and change only the parameters or columns used in measure. For example YTD, QTD, MTD measures.. etc. all the basic measures used for data analysis. It would provide really powerfull experience to business users, lower the learning curve and speed up the process of reports creation.