Ócáid
Craobhchomórtais Domhanda Power BI DataViz
Feb 14, 4 PM - Mar 31, 4 PM
Le seans 4 dul isteach, d'fhéadfá pacáiste comhdhála a bhuachan agus é a dhéanamh chuig an LIVE Grand Finale i Las Vegas
Tuilleadh eolaisNí thacaítear leis an mbrabhsálaí seo a thuilleadh.
Uasghrádú go Microsoft Edge chun leas a bhaint as na gnéithe is déanaí, nuashonruithe slándála, agus tacaíocht theicniúil.
Calculation groups can significantly reduce the number of redundant measures you have to create, by allowing you define DAX expressions as calculation items that apply to the existing measures in your model. More information about calculation groups is available in the Calculation groups article.
In Power BI Desktop when you have a local model open, navigate to Model view and select the Calculation group button in the ribbon. If you're not already in Model explorer, the Data pane opens to the Model view.
If the discourage implicit measures property is turned off, you're prompted with a dialog window to turn it on to enabling creation of the calculation group.
An implicit measure occurs when, in the Report view, you use a data column from the Data pane directly in the visual. The visual allows you to aggregate it as a SUM, AVERAGE, MIN, MAX, or some other basic aggregation, which becomes an implicit measure. Creating a calculation group discourages the creation of such implicit measures by no longer showing the summation symbol next to the data columns in the Data pane, and blocks adding the data columns to the visuals directly on aggregation axis or as values. Existing implicit measures already created in visuals will continue to work. The Discourage implicit measures property must be enabled because calculation items don't apply to implicit measures. Calculation items only apply to measures or explicit measures.
A measure or explicit measure occurs when you create a New measure and define the DAX expression to aggregate a data column. Explicit measures can also have conditional logic and filters, taking full advantage of what you can do with DAX. Tutorial: You can learn how to Create your own measures in Power BI Desktop.
Nóta
Calculation items can be created in a way that they ignore an explicit measure by the measure name for scenarios when you have a measure you do not want the calculation item to change.
Once you select Yes, or if you already have enabled the discourage implicit measures property, a calculation group is added, and you can start defining the DAX expression of the first calculation item in the DAX formula bar.
SELECTEDMEASURE() is a DAX function that acts as a placeholder for the measure to which the calculation item will apply. You can learn about the SELECTEDMEASURE DAX function from its article.
There's a Time Intelligence example of a calculation group available at in the Calculation groups in Analysis Services tabular models article, which we can use to populate some calculation items. The example can be added to any model with values by date and a Date table that is marked as a date table, or you can download the Adventure Works DW 2020 PBIX from DAX sample model - DAX.
To rename the calculation group, double-click it in the Data pane, or you can select it and use the Properties pane.
To rename the calculation group column, double-click it in the Data pane, or you can select it and use the Properties pane. The column you select is the column you'll use on visuals or in slicers to apply a specific calculation item.
The first calculation item was created as SELECTEDMEASURE() so it can be renamed by double-clicking or using the Properties pane as well.
To create additional calculation items, you can use the right-click context menu of the Calculation items section or the calculation group itself and choose New calculation item, or use the Properties pane of the Calculation items section.
Once I've added all the Time intelligence calculation items, my calculation group looks like the following image.
Notice the red triangle icons indicating errors. The errors are there because the example DAX expressions use the Date table called DimDate, so I need to update the DAX expressions to use the name Date instead. The following image shows the DAX expression before the correction.
Once I make the correction to the DAX expression, the error disappears.
Once I make the corrections for each of the errors in the calculation items, the red triangle warning icons no longer appear.
To reorder the calculation items in whatever logical way you prefer, you can select the Calculation items section in the Properties pane, or right-click context menu of the calculation item to move it up or down in the list.
Calculation items use the underlying measure formatting by default. We might want to instead display YOY% as a percentage. To do so, select the YOY% calculation item, then turn on Dynamic format string in the properties pane, which allows you to specify a DAX expression to create a format string. For this example, it doesn’t require any conditional elements, so simply #,##0.00% will change the format to a percentage when this calculation item is applied, as shown in the following image.
To use your new calculation group in a Report, go to the Report view, create a Matrix visual and add the following:
Nóta
If the measure Orders is not created in the mode, you can use a different measure or go to the ribbon and choose New Measure with this DAX expression.
Orders = DISTINCTCOUNT('Sales Order'[Sales Order])
The following image shows building a visual.
Calculation items on the Columns in the Matrix visual are showing the measure Orders grouped by each of the calculation items. You can also apply an individual calculation item to multiple measures by adding the calculation group column to a Slicer visual.
You can create a new measure with a DAX expression that will utilize a calculation item on a specific measure.
To create an [Orders YOY%] measure you can use the calculation item with CALCULATE.
Orders YOY% =
CALCULATE(
[Orders],
'Time Intelligence'[Time Calculation] = "YOY%"
)
Finally, if you add additional calculation groups to the model and you want to specify the order in which they apply to measures, you can adjust the calculation group precedence in the Calculation groups section properties pane, as shown in the following image.
You can learn more about calculation groups precedence in the Calculation groups in Analysis Services tabular models article.
The following articles describe more about data models, and also describe DirectQuery in detail.
DirectQuery articles:
Ócáid
Craobhchomórtais Domhanda Power BI DataViz
Feb 14, 4 PM - Mar 31, 4 PM
Le seans 4 dul isteach, d'fhéadfá pacáiste comhdhála a bhuachan agus é a dhéanamh chuig an LIVE Grand Finale i Las Vegas
Tuilleadh eolaisOiliúint
Deimhniú
Microsoft Certified: Power BI Data Analyst Associate - Certifications
Demonstrate methods and best practices that align with business and technical requirements for modeling, visualizing, and analyzing data with Microsoft Power BI.
Doiciméadúchán
Calculation groups in Analysis Services tabular models
Learn how calculation groups can significantly reduce the number of redundant measures by grouping common measure expressions as calculation items.
Author calculation groups in Power BI Desktop to enable the reuse of common measure expressions in complex semantic models.
Create dynamic format strings for measures in Power BI Desktop - Power BI
Learn how to create dynamic format strings for measures in Power BI Desktop measures.