Forum Discussion
What-If Parameter and Matrix Visibility Based on User Input
I'm trying to control the visibility of a matrix visual in Power BI based on a numeric What-If parameter. The goal is:
・When the parameter is blank (i.e., no user input), the matrix should be completely hidden (including rows and columns).
・When the user inputs a value (including 0), the matrix should display data accordingly.
I created a measure like this to control visibility:
ShowDataFlag =
VAR SelectedValue = 'InputValue'[InputValue]
RETURN
IF(SelectedValue >= 0, 1, 0)
Then I applied this measure as a visual-level filter (ShowDataFlag = 1) on the matrix.
Here’s the issue:
・If the parameter is blank and the user inputs 0, the matrix remains hidden.
・If the user first inputs a value like 10, and then changes it to 0, the matrix displays correctly.
It seems that Power BI doesn’t recognize the selection of 0 as a valid input when coming from a blank state. I also tried using HASONEVALUE() and ISBLANK() in various combinations, but the behavior persists.
Is there a reliable way to detect when the user has explicitly selected or entered 0 in a What-If parameter, even if the initial state was blank?
- Anonymous1 year ago
Hi mh20221111,
In Power BI, a blank value is not the same as zero blank means "no data," while zero is an actual number. Because of this design, Power BI does not automatically treat a blank as 0, which is why entering 0 from a blank state may not be recognized. To handle this, you need to explicitly replace blanks with zero in your DAX using functions like COALESCE([Value], 0) or IF(ISBLANK([Value]), 0, [Value]).
Thanks & Regards,
Prasanna Kumar
9 Replies
- SamWiseOwl
Super User
Hi mh20221111
Rather than test for 0 could you test for blank:ShowDataFlag =VAR SelectedValue = InputValue[InputValue Value]RETURNIF(not(ISBLANK( SelectedValue)), 1, 0)
Feel free to modify test file to match yours more.
- mh20221111
Helper II
I appreciate your help! I tried the measures and the uploaded file, but unfortunately, they didn't quite meet my requirements. Thank you so much for your assistance!
- SamWiseOwl
Super User
How does it differ? Feel free to provide your own file with the error described 🙂
- AnonymousNot applicable
Hi mh20221111,
Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to SamWiseOwl for prompt and helpful response.
Just following up to see if the response provided by community member were helpful in addressing the issue.
If one of the responses helped resolve your query, please consider marking it as the Accepted Solution. Feel free to reach out if you need any further clarification or assistance.
Best regards,
Prasanna Kumar- mh20221111
Helper II
I received one response, but it did not meet the requirements.
Is the fact that Power BI does not recognize 0 as a valid input when coming from a blank state a limitation of its specifications?
- AnonymousNot applicable
Hi mh20221111,
In Power BI, a blank value is not the same as zero blank means "no data," while zero is an actual number. Because of this design, Power BI does not automatically treat a blank as 0, which is why entering 0 from a blank state may not be recognized. To handle this, you need to explicitly replace blanks with zero in your DAX using functions like COALESCE([Value], 0) or IF(ISBLANK([Value]), 0, [Value]).
Thanks & Regards,
Prasanna Kumar
- mh20221111
Helper II
I’ve come to understand that, due to Power BI’s design, a blank state is not automatically treated as zero, and therefore entering 0 may not be recognized. Appreciate your help!