Power Dynamics
  • Power Dynamics
  • 🍕My name
  • D365 CE
    • Copilot
      • 🥐Add Copilot into Rich Text Control
    • Sales
      • Copilot in D365 Sales
      • Export record to PDF
    • Customer Experience
      • Contact Center (Omnichannel)
        • 🐚Internal Live Chat in MDA
        • 📢Add Chat Widget to Power Pages - Proactive Chat
      • Attachment Control
      • Case Routing: Basic Routing rule set
      • Custom SLA for any Entity
      • Customer Insight
        • Journey - Custom Trigger - Call Power Automate
    • Field Service
  • Power Platform
    • Analytics
    • Dataverse
      • Use case for the feature of Record ownership across Business Unit
      • 💡Workaround: Change the OOB "Exchange Rate" of a record
      • Using a Virtual Entity to store historical log (sample)
      • Disable Empty Address record
      • Using Adaptive card
      • Block Unmanaged Customizations
      • 🪃Recycle Bin on Dataverse (Preview)
    • Model Driven App
      • 💡Run SSRS report on MDA mobile
      • 💡Tip: Create a Security Role with "App Opener" minimum privileges
      • Tag @person to notify in MDA
      • Auto search on the Lookup field
      • Activities with multiple related records
      • Embedded Power BI - Dashboard
      • Embedded Power BI - Form
      • "Custom Help" - Is it help?
      • New modern Command Bar
      • Tip: Hide the button "Add Existing Record" on subgrid
      • Custom Page - Why not?
      • Hiding sensitive column data
    • Canvas App
    • Fabric & Power BI
      • New Text slicer
      • Dataverse link to Microsoft Fabric
      • 💡Leveraging Interactive Warehouse Floor Maps in Power BI
      • Calculation Group for Time Intelligence
    • Power Automate
      • ✅Sequential Approval
      • 📤Create an Appointment by Outlook Graph API
      • Dowload SSRS Report and Send email
      • Power Automate: Add a table in Email
      • 💡Tips: Get "DisplayName" of the Lookup field on Power Automate
      • E-sign: Power Automate & DocuSign
  • D365 Finance & Operation
    • General
      • 🇻🇳D365 FnO - Virtual entities: Use case
    • Finance
      • Consolidating Customer & Vendor Balances
    • Supply Chain
      • Landed Cost Series
        • Landed Cost- Essential Configuration
        • Landed Cost Scenarios 1
Powered by GitBook
On this page
  • DAX: SELECTEDMEASURE()
  • Not Using Calculation Group
  • Using Calculation Group
  • Checking now ...

Was this helpful?

  1. Power Platform
  2. Fabric & Power BI

Calculation Group for Time Intelligence

#PowerBI, #Measure

PreviousLeveraging Interactive Warehouse Floor Maps in Power BINextPower Automate

Last updated 1 year ago

Was this helpful?

Today, I would like to share about the Calculation Group functionality in Power BI in my current report.

In the Power BI report, I built the Visualization to show Sales Revenue and Cost Amount in some measures such as QTD, YTD, and LYTD. I created 6 measures: 3 for Sales Revenue and 3 for Cost Amount, so take time.

Then I am using the Calculation Group to do it. This function is helping me save time save effort.

Calculation groups are a simple way to reduce the number of measures in a model by grouping common measure expressions. Calculation groups work with existing explicit DAX measures by automating repetitive patterns.

So, how I can do ...

DAX: SELECTEDMEASURE()

Supporting the Calculation Group function, the new DAX function has been released - .

They are used by expressions for calculation items or dynamic format strings to reference the measure that is in context. Returns the measure that is currently being evaluated.

Syntax: SELECTEDMEASURE() - without parameter.

Not Using Calculation Group

In my Power BI report, I have the Sales Data with Sales Revenue and Cost Amount.

I created 2 based measures: [Sales Revenue] and [Cost Amount] for my report.

-- Based Measure
Sales Revenue = SUM(Sales[Sales Revenue])
Cost Amount = SUM(Sales[Cost Amount])

Initially, I have 6 Time Intelligence Measures: 3 for Sales Revenue and 3 for Cost Amount as below.

YTD Sales Revenue = CALCULATE([Sales Revenue],DATESYTD('Date'[Date]))
YTD Cost Amount = CALCULATE([Cost Amount],DATESYTD('Date'[Date]))

LYTD Sales Revenue = CALCULATE([Sales Revenue],SAMEPERIODLASTYEAR('Date'[Date]))
LYTD Cost Amount = CALCULATE([Cost Amount],SAMEPERIODLASTYEAR('Date'[Date]))

QTD Sales Revenue = CALCULATE([Sales Revenue],DATESQTD('Date'[Date]))
QTD Cost Amount = CALCULATE([Cost Amount],DATESQTD('Date'[Date]))

Sample Visualization: Sales by Region and Cost by Region

  • Sales by Region: using 3 Time Intelligence measures.

  • Cost by Region: using 3 Time Intelligence measures.

Using Calculation Group

Now, I will use this report and using Calculation Group to introduce to you.

The first thing is to make sure you already turned on this feature in Option Setting.

When using the Calculation Group functionality, I will create a Calculation Group called "Cal-Time Intelligence" with corresponding Calculation Items: "Item-QTD", "Item-YTD", and "Item-LYTD" for Sales Revenue and Cost Amount. Based on the visualization, the Calculation Group functionality will show related measures for the current measure that is being used.

 CALCULATION GROUP "Cal-Time Intelligence"
--   CALCULATION ITEMS
        Item-QTD = CALCULATE(SELECTEDMEASURE(), DATESYTD('Date'[Date]))
        Item-YTD = CALCULATE(SELECTEDMEASURE(), DATESQTD('Date'[Date]))
        Item-LYTD = CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR ('Date'[Date]))
    

Based on that, open the Power BI report and create...

In the Model View >> click Calculation Group. The new Calculation Group will be created automatically as below.

In the next step, we just create a Calculation Item for each measure QTD, YTD, and LTYD using SELECTEDMEASUREDAX functionality.

Create Calculation Items:

That's here, I did finish creating Calculation Items.

Checking now ...

Back to my report, I used the Matrix Table visualization

Sales by Region (Matrix):

  • Column: using Calculation Group Column "Time Intelligence"

  • Value: using based measure "Sales Revenue"

You can see, the showing column which is Calculation Items - you don't need to drag & drop many measures for this visualization as initially. When using Calculation Group, the Power BI engine will calculate and show these Calculation Item columns automatically.

Cost by Region (Matrix):

  • Column: using Calculation Group Column "Time Intelligence"

  • Value: using based measure "Cost Amount"

For each visualization, we will show another insight by another measure. So, the Calculation Group with Dax SELECTEDMEASURE that helps bulk calculate and show measures is in context. Moreover, it's helped me reduce many measures I need to create and maintain for my report.

Now I will show you how this function is running...

Hoping well...

[NTD]yns.asia ... Thank you.

💹
🍎
😏
SELECTEDMEASURE
☕
❤️
invite me a cup.
Sales by Region
Cost by Region
Turn on Calculation Group authoring.
Create Calculation Group
Calculation Group & Items
Sales by Region (Matrix): using Calculation Group and Base Measure "Sales Revenue"
Cost by Region: using Calculation Group and Base Measure "Cost Amount"
Calculation Group sample: Time Intelligence
Page cover image