Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sanjyot_firke
Helper I
Helper I

SeleectedValue not working for dynamic measure refresh

Hi Everyone,

We have a matrix table where we are showing data for 8 financial years (FY22 to FY30) in total.

We have to implement the following condition for the financial years

For prior years (FY22,23,24), we need to show actuals.

For current year (FY25), we need to toggle between Budget and different forecast.

For next year (FY26), we need to toggle between 5 year forecast and budget.

For years later (FY27,28,29,30), we need to show 5 year forecast.

 

We are calculating $ value using measures and the measure are created using a filter based on a data type filte. We are trying to use Selectedvalue function from Pwoer BI to capture the Data type from the user and calculate the measures dynamically for current year.. However, Selectedvalue is not working and returning blank data. So we get only a blank column for current year.

 

Data Type table contains values like Actuals, Budget, Forecast V1, Forecast V2.

 

Can someone please help us to resolve this to fetch the data for current year using the value selected by the user from the Data Type slicer?

 

Regards

 

 

2 ACCEPTED SOLUTIONS
SolomonovAnton
Solution Sage
Solution Sage

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

  1. 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.
  2. 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")
  3. 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.
  4. 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!

View solution in original post

v-csrikanth
Community Support
Community Support

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.

View solution in original post

8 REPLIES 8
v-csrikanth
Community Support
Community Support

Hi @sanjyot_firke 

We haven't heard from you since last response and just wanted to check whether the solution provided has worked for you. If yes, please Accept as Solution to help others benefit in the community.
Thank you.

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.

v-csrikanth
Community Support
Community Support

HI @sanjyot_firke 

It's been a while since I heard back from you and I wanted to follow up. Have you had a chance to try the solutions that have been offered?
If the issue has been resolved, can you mark the post as resolved? If you're still experiencing challenges, please feel free to let us know and we'll be happy to continue to help!
Looking forward to your reply!

Best Regards,
Community Support Team _ C Srikanth.

v-csrikanth
Community Support
Community Support

HI @sanjyot_firke 

I wanted to follow up since I haven't heard from you in a while. Have you had a chance to try the suggested solutions?
If your issue is resolved, please consider marking the post as solved. However, if you're still facing challenges, feel free to share the details, and we'll be happy to assist you further.
Looking forward to your response!

Best Regards,
Community Support Team _ C Srikanth.

v-csrikanth
Community Support
Community Support

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.

sanjyot_firke
Helper I
Helper I

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.

SolomonovAnton
Solution Sage
Solution Sage

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

  1. 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.
  2. 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")
  3. 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.
  4. 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!

Thank you @SolomonovAnton for the detailed answer.

We are not keen on creating individual measure variables for each data types as we have lot of intermdiate budget versions that we need to create measures for. This will create an issue in terms of maintenance or when a new data type is added or deleted from the table.

Is there a way where we can reuse 1 single measure to toggle between multiple data types?

 

Regards,

Sanjyot

Akash_Varuna
Community Champion
Community Champion

Hi @sanjyot_firkeIt might be that the slicer allows multiple selections, causing SELECTEDVALUE to return blank. Ensure the slicer is set to Single Select and add a default value in the measure to handle blank cases. Use SWITCH logic to handle the conditions dynamically for each financial year based on the slicer input.

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.