Forum Discussion
Reference to a Field Parameter: Calculate(Selectedvalue(Parameter'[Parameter]), ...)
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
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.
Anonymous, 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
3 Replies
- bhanu_gautamSuper User
Anonymous
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()
) - Alex_SawdoResolver II
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.
- v-prasareCommunity Support
Anonymous, 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