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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Sssman
Regular Visitor

Slicer can't save user inputted values when switching page.

Hi,

I have created this slicer with help of ChatGPT because the default range slicer wasn't providing some customizations I wanted. For the most part, it works as expected, except for one thing, when I input values to the Min and Max box, the filter works but if I switch the page and go back to the page again, the Min and Max box will not show the user inputted values but the filter will still be active. 

I have uploaded the files here, can someone please help me save the user input values, I would really appreciate it.
https://github.com/suvojithaldar/CustomRangeSlicer

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @Sssman,

 

It sounds like you're restoring the filter state from the visual host correctly when your visual reinitializes on page change, so at least the visuals are filtered correctly. You will have the responsibility of updating your UI.

 

For any input elements, you'll need some logic in there to fill them in - there would be two ways I'd consider this:

 

  1. If restoring from the persisted filter state is acceptable, process your filter JSON to obtain the min and max values and make these the initial values of the corresponding input elements.
  2. If the exact values the user typed are what you want to store (as Power BI may adjust the persisted filter to suit the data and may not reflect the user's original input 100%). In this case, I'd consider this approach:
    • Create properties to store the type values and persist them using the IVisualHost.persistProperties API.
    • These properties can be read when your visual reinitializes and populates into the input elements similar to the above mechanism.
    • Keeping these properties hidden from the user when you create your formatting model so they cannot be manually modified from the pane (this could be fine if you don't mind them being visible, but bear in mind that you'll need to 'sync' them both ways rather than assuming that they'll only be written to from the visual).

Good luck!

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

2 REPLIES 2
dm-p
Super User
Super User

Hi @Sssman,

 

It sounds like you're restoring the filter state from the visual host correctly when your visual reinitializes on page change, so at least the visuals are filtered correctly. You will have the responsibility of updating your UI.

 

For any input elements, you'll need some logic in there to fill them in - there would be two ways I'd consider this:

 

  1. If restoring from the persisted filter state is acceptable, process your filter JSON to obtain the min and max values and make these the initial values of the corresponding input elements.
  2. If the exact values the user typed are what you want to store (as Power BI may adjust the persisted filter to suit the data and may not reflect the user's original input 100%). In this case, I'd consider this approach:
    • Create properties to store the type values and persist them using the IVisualHost.persistProperties API.
    • These properties can be read when your visual reinitializes and populates into the input elements similar to the above mechanism.
    • Keeping these properties hidden from the user when you create your formatting model so they cannot be manually modified from the pane (this could be fine if you don't mind them being visible, but bear in mind that you'll need to 'sync' them both ways rather than assuming that they'll only be written to from the visual).

Good luck!

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Sssman
Regular Visitor

Thanks a lot! I was able to save the user input using the first method that you suggested.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Top Solution Authors