Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Dear community,
I have created a field parameter, which contains period measures, e.g. "MTD", "YTD", "RunRate",...).
I would like to create a measure, which references to my parameter.
This measure should calculate the periods for a certain KPI.
Calculate(Selectedvalue(Parameter'[Parameter]), KPI="Revenue") does not work, as it returns
Measures for Parameter_all Periods'[25 ACT MTD P01 Ø] instead of the value.
Thank you very much for any support
Solved! Go to Solution.
I use a similiar solution to @bhanu_gautam , with a few differences that allows a little more customization:
Selected Measure =
SWITCH(
SELECTEDVALUE(
'All Periods Parameter'[All Periods Parameter Fields]
),
NAMEOF('Measures for Parameter_all Periods'[25 ACT MTD P01 Ø]),
'Measures for Parameter_all Periods'[25 ACT MTD P01 Ø],
NAMEOF('Measures for Parameter_all Periods'[25 ACT MTD P02 Ø]),
'Measures for Parameter_all Periods'[25 ACT MTD P02 Ø],
NAMEOF('Measures for Parameter_all Periods'[25 ACT MTD P03]),
'Measures for Parameter_all Periods'[25 ACT MTD P03]
)
You can also wrap the returned measure in a FORMAT() function to control the format directly of the returned value, and you can add additional measures if needed.
@lukmtb08, As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?
@Alex_Sawdo & @bhanu_gautam Thanks for your prompt response
Thanks,
Prashanth Are
MS Fabric community support
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query
@lukmtb08, As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?
@Alex_Sawdo & @bhanu_gautam Thanks for your prompt response
Thanks,
Prashanth Are
MS Fabric community support
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query
I use a similiar solution to @bhanu_gautam , with a few differences that allows a little more customization:
Selected Measure =
SWITCH(
SELECTEDVALUE(
'All Periods Parameter'[All Periods Parameter Fields]
),
NAMEOF('Measures for Parameter_all Periods'[25 ACT MTD P01 Ø]),
'Measures for Parameter_all Periods'[25 ACT MTD P01 Ø],
NAMEOF('Measures for Parameter_all Periods'[25 ACT MTD P02 Ø]),
'Measures for Parameter_all Periods'[25 ACT MTD P02 Ø],
NAMEOF('Measures for Parameter_all Periods'[25 ACT MTD P03]),
'Measures for Parameter_all Periods'[25 ACT MTD P03]
)
You can also wrap the returned measure in a FORMAT() function to control the format directly of the returned value, and you can add additional measures if needed.
First, ensure that your field parameter is correctly set up and that it is being used in your report.
Create a measure that uses the SELECTEDVALUE function to get the selected period from your parameter.
Use the SWITCH function to handle different periods and calculate the KPI accordingly.
DAX
KPI Calculation =
VAR SelectedPeriod = SELECTEDVALUE('Parameter'[Parameter])
RETURN
SWITCH(
TRUE(),
SelectedPeriod = "25 ACT MTD P01 Ø", CALCULATE([Revenue], 'Measures for Parameter_all Periods'[25 ACT MTD P01 Ø]),
SelectedPeriod = "25 ACT MTD P02 Ø", CALCULATE([Revenue], 'Measures for Parameter_all Periods'[25 ACT MTD P02 Ø]),
SelectedPeriod = "25 ACT MTD P03", CALCULATE([Revenue], 'Measures for Parameter_all Periods'[25 ACT MTD P03]),
-- Add more conditions as needed
BLANK()
)
Proud to be a Super User! |
|
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |