Reply
Highlighted
Moderator
Posts: 208
Registered: ‎06-23-2015

Submitting Quick Measure Templates

[ Edited ]

In the April release of Power BI Desktop, we released a powerful feature called quick measures that helps create DAX measures based on templates for common patterns and expressions. We're continuing to build more of these templates to address different scenarios, but we're also looking for help creating more measures to share with everyone. If you have common calculations that would be helpful for the rest of the community, you can submit them using the following template. We'll evaluate the DAX statement and may use it as the basis of a future quick measure. You can even get your name immortalized in Power BI Desktop!

 

The forum for submitting them is here: https://community.powerbi.com/t5/Quick-Measures-Gallery/bd-p/QuickMeasuresGallery

 

Great submissions will be:

  • Clear A secondary benefit of quick measures is that they're a great stepping stone to learning more about the DAX language. If your submission is easy to read and understand it'll increase the chances of being selected. You can even put comments in the DAX to help people learn more!
  • Generic These are templates that will be available to everyone who uses Power BI. They need to address common calculations or expressions that are applicable in a wide range of business scenarios.
  • Performant There are many ways to write the same expression in DAX, and they don't all share the same performance characteristics. Use best practices to make sure the expressions give results as quickly as possible. There are always cases with the potential to be slow (distinct counts, for example!) but do what you can to optimize your expression.

You'll need to upload a Power BI Desktop file with an example of the measure in action, and you can add a URL link to a report that has been published using Power BI's Publish to Web feature. You will also need to add a thumbnail to the forum post, which can just be a screenshot of the results in a visual.

 

Template

To see what your submission should look like, let's take the Average per category quick measure as an example.

This is how the dialog looks when configuring the calculation:

clip_image030

And here's how it would look in the template that you submit:

 

Name:

Average per category

 

Description:

Calculate the average of the base value within the category

 

Parameters:

Name: Base value

Tooltip: The value you want to average

Type: Numerical field / measure

 

Name: Category

Tooltip: The category in which you want to calculate the average

Type: Categorical field

 

DAX:

Average {Base value} per {Category} =

AVERAGEX(

  KEEPFILTERS(VALUES({Category})),

  CALCULATE({Base value})

)

 

The valid 'types' for the parameters are:

  • Numeric field / measure
    • These are aggregates that you might use in your calculation, for example {Base value} used above.
  • Categorical field
    • These are fields, typically text, used as categories in your measure, for example {Category} used above.
  • Instance value
    • These parameters are specific values from a field. The 'Filtered value' quick measure uses this in the 'Filter' parameter.
  • Date field
    • For time intelligence type measures, this specifies a date field is needed.
  • Integers
    • Whole numbers that might be used as parameters in DAX functions
  • Selection list

    • A list of options that the user can select from (e.g., DAY / MONTH / QUARTER / YEAR)

     

 

So get writing and submit your ideas for quick measures using this template! While we can't guarantee that we'll use them in the product, and we may have to edit the DAX, we will review all the submissions and prioritize those that get the most votes on the forum. Thank you!

Frequent Visitor
Posts: 6
Registered: ‎08-07-2017

Re: Submitting Quick Measure Templates

Hi,

 

I would like to submit a quick measure, but there is a feature that I don't understand and it's not explained in the template above.

 

The existing 'Difference from filtered value' measure has a selection list field called 'Blanks'. According to the value selected, the final formula changes.

 

How should I build the template to achieve this, to change some details in the final formula according to a selection list field?

 

Thank you!