Analysis Services tabular models can have hundreds of base DAX measures, duplications of code, and syntax. However, with the new world of DAX Calculation groups we can re-use calculations and apply them to virtually any measure.
Within analysis services, DAX Calculation Groups give the user the ability to apply multi-use calculations to measures. This feature is available on Analysis Services in SQL Server 2019 2.3 and should be available in the SQL Server 2019 release. Currently, calculation groups can only be created with the Tabular Editor UI.
The first, and most prominent example of this is time intelligence and the application of MTD (Month to Date), YTD (Year to Date), and QTD (Quarter to Date) calculations. By reducing the number of measures, with calculation groups we can present a clearer user interface to the users.
Below are two images that show the calculation group hierarchy. The hierarchy is used to call a calculation on a measure.
The calculation group is called calculation group, the attribute is called time, and the item is called MTD.
The calculation items use the new ‘SelectedMeasure’ function. When called ‘SelectedMeasure’ will replace the measure that you have selected for calculation.
CALCULATE(SELECTEDMEASURE(), DATESMTD(DimDate[Date])) CALCULATE(SELECTEDMEASURE(), DATESYTD(DimDate[Date])) CALCULATE(SELECTEDMEASURE(), DATESQTD(DimDate[Date]))
The script below calculates the measure ‘InternetTotalSales’ upon the calculation items; ‘Current’, ‘QTD’, ‘YTD’ etc.
EVALUATE CALCULATETABLE ( SUMMARIZECOLUMNS ( DimDate[CalendarYear], DimDate[EnglishMonthName], "Current", CALCULATE ( [InternetTotalSales], 'CalculationGroup'[Time] = "Current" ), "QTD", CALCULATE ( [InternetTotalSales], 'CalculationGroup'[Time] = "QTD" ), "YTD", CALCULATE ( [InternetTotalSales], 'CalculationGroup'[Time] = "YTD" ), "PY", CALCULATE ( [InternetTotalSales], 'CalculationGroup'[Time] = "PY" ), "PY QTD", CALCULATE ( [InternetTotalSales], 'CalculationGroup'[Time] = "PY QTD" ), "PY YTD", CALCULATE ( [InternetTotalSales], 'CalculationGroup'[Time] = "PY YTD" ) ), DimDate[CalendarYear] IN { 2012, 2013 }
And, when we run this script we get the following table:
Looking forward, we should see this eventually in PowerBI, SQL Server Data tools, and Azure Analysis Services. So, watch this space. Read more from Microsoft here
Throughout this year, you will see more blogs and guides from me on this topic as it unfolds.
Databricks Vs Synapse Spark Pools – What, When and Where?
Databricks or Synapse seems to be the question on everyone’s lips, whether its people asking
May
Power BI to Power AI – Part 2
This post is the second part of a blog series on the AI features of
Apr
Geospatial Sample architecture overview
The first blog ‘Part 1 – Introduction to Geospatial data’ gave an overview into geospatial
Apr
Data Lakehouses for Dummies
When we are thinking about data platforms, there are many different services and architectures that
Apr
Enable Smart Facility Management with Azure Digital Twins
Before I started writing this blog, I went to Google and searched for the keywords
Apr
Migrating On-Prem SSIS workload to Azure
Goal of this blog There can be scenario where organization wants to migrate there existing
Mar
Send B2B data with Azure Logic Apps and Enterprise Integration Pack
After creating an integration account that has partners and agreements, we are ready to create
Mar
Incremental Group is acquired by Telefónica Tech
Incremental’s acquisition by Telefónica Tech powers the next phase of growth for the digital technology
Mar