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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors