Forum Discussion
SeleectedValue not working for dynamic measure refresh
- 1 year ago
To dynamically show different data types (Actuals, Budget, Forecast) based on the financial year and a slicer selection using SELECTEDVALUE(), ensure the setup is correct and follows this structured approach:
✅ Step-by-Step Solution
- Ensure Proper Relationship
Confirm that your Data Type table is a disconnected table (no relationship to the fact table) and used only for slicer purposes. - Capture the Slicer Selection
Create a measure to capture the user's selection:DAX Selected Data Type = SELECTEDVALUE('Data Type'[Type])If this returns blank, make sure:- The slicer is coming from 'Data Type'[Type].
- Exactly one value is selected in the slicer (or provide a default):
DAX Selected Data Type = SELECTEDVALUE('Data Type'[Type], "Budget") - Dynamic Measure Logic
Create a dynamic measure to choose the correct value based on the year:DAX Dynamic Value = VAR SelectedType = SELECTEDVALUE('Data Type'[Type], "Budget") VAR CurrentYear = "FY25" VAR NextYear = "FY26" VAR FY = SELECTEDVALUE('Date'[FinancialYear]) RETURN SWITCH(TRUE(), FY IN {"FY22", "FY23", "FY24"}, [Actuals Measure], FY = CurrentYear && SelectedType = "Budget", [Budget Measure], FY = CurrentYear && SelectedType = "Forecast V1", [Forecast V1 Measure], FY = CurrentYear && SelectedType = "Forecast V2", [Forecast V2 Measure], FY = NextYear && SelectedType = "Budget", [Budget Measure], FY = NextYear && SelectedType = "5 Year Forecast", [5 Year Forecast Measure], FY IN {"FY27", "FY28", "FY29", "FY30"}, [5 Year Forecast Measure], BLANK() )Replace each `[Measure]` placeholder with the actual measure for that data type. - Matrix Setup
- Use the Financial Year as your column. - Use the [Dynamic Value] measure as your values.
✅ Additional Tips
- Test the Selected Data Type measure separately in a card visual to ensure it reacts to slicer selection.
- If you need multiple slicer interactions, consider using Field Parameters or the TREATAS() function for more advanced control.
✔️ If my message helped solve your issue, please mark it as Resolved!
👍 If it was helpful, consider giving it a Kudos!
- Ensure Proper Relationship
- 1 year ago
Hi sanjyot_firke
Thanks for reaching out to Fabric Community.
Yes you’re correct maintaining separate measures for every data type (Budget, Actuals, multiple Forecasts, etc.) can become difficult to manage, especially as the number of types grows or changes. Fortunately, there’s a scalable pattern you can use a single measure with LOOKUPVALUE or CALCULATE—that works dynamically with your slicer.
To simplify maintenance, you can use a single dynamic measure that responds to both year and data type slicer selections, without creating separate measures for each data type.**********************************************************************
Dynamic Value =
VAR SelectedType = SELECTEDVALUE('Data Type'[Type], "Budget")
VAR FY = SELECTEDVALUE('Date'[FinancialYear])
RETURN
SWITCH(
TRUE(),
FY IN {"FY22", "FY23", "FY24"}, CALCULATE(SUM('FactTable'[Value]), 'FactTable'[DataType] = "Actuals"),
FY IN {"FY25", "FY26"}, CALCULATE(SUM('FactTable'[Value]), 'FactTable'[DataType] = SelectedType),
FY IN {"FY27", "FY28", "FY29", "FY30"}, CALCULATE(SUM('FactTable'[Value]), 'FactTable'[DataType] = "5 Year Forecast"),
BLANK()
)
**********************************************************************-
Ensure your fact table is in a long format (one column for Value, one for Data Type, etc.).
-
The Data Type slicer should be based on a disconnected table.
-
This pattern allows you to add or remove data types without changing your measure logic.
If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth. -
Thank you so much for the responses team.
I am going to try both the above suggested solutions and let everyone know which one worked for us.