March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi!
I have this sample data table. The numbers under Steps 1 to 3 show the number of minutes of that step.
Date | Step 1 | Step 2 | Step 3 |
1/1/2024 | 1 | 5 | 20 |
2/1/2024 | 7 | 8 | 9 |
3/15/2024 | 10 | 11 | 12 |
I created a SUM measure for each Step and then created a field parameter using those 3 steps.
My goal is to show in a line chart the no. of minutes based on the selected Step from the field parameter.
So it works fine and I decided to add detail label that shows the % variance from previous month using the measures below:
SELECTED =
VAR __SelectedValue =
SELECTCOLUMNS (
SUMMARIZE ( Parameter, Parameter[Parameter], Parameter[Parameter Fields] ),
Parameter[Parameter]
)
RETURN IF ( COUNTROWS ( __SelectedValue ) = 1, __SelectedValue )
Previous Month Value =
VAR SelectedMeasure = [SELECTED]
RETURN
SWITCH(
TRUE(),
SelectedMeasure = "Step 1m", CALCULATE([Step 1m], PREVIOUSMONTH('Calendar'[Date])),
SelectedMeasure = "Step 2m", CALCULATE([Step 2m], PREVIOUSMONTH('Calendar'[Date])),
SelectedMeasure = "Step 3m", CALCULATE([Step 3m], PREVIOUSMONTH('Calendar'[Date])),
BLANK()
)
MoM Difference =
VAR SelectedMeasure = [SELECTED]
RETURN
SWITCH(
TRUE(),
SelectedMeasure = "Step 1m", IF([Previous Month Value]=0,BLANK(),FORMAT(DIVIDE([Step 1m],[Previous Month Value])-1,"0.0%")),
SelectedMeasure = "Step 2m", IF([Previous Month Value]=0,BLANK(),FORMAT(DIVIDE([Step 2m],[Previous Month Value])-1,"0.0%")),
SelectedMeasure = "Step 3m", IF([Previous Month Value]=0,BLANK(),FORMAT(DIVIDE([Step 3m],[Previous Month Value])-1,"0.0%")),
BLANK()
)
Initially, I was using SELECTEDVALUE() but I kept getting an error: "There's an error that showed: Calculator error in measure "[MoM Difference]". Column [Parameter] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression."
I then found this article in which it says to use the measure below:
VAR __SelectedValue =
SELECTCOLUMNS (
SUMMARIZE ( Parameter, Parameter[Parameter], Parameter[Parameter Fields] ),
Parameter[Parameter]
)
RETURN IF ( COUNTROWS ( __SelectedValue ) = 1, __SelectedValue )
The problem is that now, it would only show the % variance if the reader selects only ONE from the field parameter slicer since the condition in the new measure looks only if the counted rows =1 . How to keep showing the % variance regardless of the no. of selected field parameters?
Here's my sample file
When 1 is selected:
When more than 1 is selected (doesn't appear anymore).
You could unpivot the Step columns in Power Query (Transform --> Unpivot Columns), resulting in the following:
This should enable you to use the new Step column in a slicer instead of a field parameter.
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |