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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
alohaes
Helper I
Helper I

PowerBI JS slicer configuration on a ranged date slicer is not working correctly

Hey fellas. So, I am applying an advanced filter on a ranged date slicer and settings its state using the settings slicers in the report configuration. Issue is that, when i view this report in edit mode in a embedded page and hover over any visual's filters which are tied to the date, I can see the slicer filters of date being applied on it 2 times and this is preventing manual user changes on the said slicer to be applied to other concerned visuals. PFB the screenshot that I have attached for reference.

alohaes_0-1748011709664.png

Appreciate any and all help to figure this thing out because its a really critical issues for us.

1 ACCEPTED SOLUTION
alohaes
Helper I
Helper I

I think I found the issue. There is a hidden relative date slicer which also targets the same table and column as the date range advanced slicer and the slicer config that I passed in was targeting all the slicers with the target selector schema and because of that it seems to apply the fitlers twice on all the concerned visuals. 

To fix this, I have adopted use of phased embedding and setting the date range slicer filters in the loaded event using the setSlicerState method. @DataNinja777 thanks for your help! Your way of fixing it had me think about this scenario as well 🙂

View solution in original post

3 REPLIES 3
alohaes
Helper I
Helper I

I think I found the issue. There is a hidden relative date slicer which also targets the same table and column as the date range advanced slicer and the slicer config that I passed in was targeting all the slicers with the target selector schema and because of that it seems to apply the fitlers twice on all the concerned visuals. 

To fix this, I have adopted use of phased embedding and setting the date range slicer filters in the loaded event using the setSlicerState method. @DataNinja777 thanks for your help! Your way of fixing it had me think about this scenario as well 🙂

v-pbandela-msft
Community Support
Community Support

Hi @alohaes,

Thank you for reaching out in Microsoft Community Forum.

Thank you @DataNinja777   for the helpful response.

As suggested by DataNinja777,  I hope this information was helpful. Please let me know if you have any further questions or you'd like to discuss this further. If this answers your question, please "Accept as Solution" and give it a 'Kudos' so others can find it easily.

Please continue using Microsoft community forum.

Regards,
Pavan.

DataNinja777
Super User
Super User

Hi @alohaes ,

 

The issue is caused by applying the same filter twice—once through the slicer visual and again via JavaScript using settings.slicers or setFilters(). When both are applied on the same column, Power BI retains both filters and treats them as separate constraints, which locks the slicer from user interaction because it can't override a filter that's already applied programmatically. The solution depends on whether you want the slicer to be interactive or static.

If the slicer should be interactive and let the user control the date range, avoid applying the same filter through JavaScript. Don't use report.setFilters() or settings.slicers for the date column. Just rely on the slicer visual embedded in the report.

report.updateSettings({
  slicers: [] // avoid setting slicer filter from JS if user interaction is needed
});

If the date should be fixed by JavaScript (e.g., for a rolling window), then apply the filter programmatically and either hide the slicer or remove it from the report so there's no conflict.

const dateFilter = {
  $schema: "http://powerbi.com/product/schema#advanced",
  target: {
    table: "YourTableName",
    column: "Date"
  },
  logicalOperator: "And",
  conditions: [
    { operator: "GreaterThanOrEqual", value: "2025-04-23" },
    { operator: "LessThanOrEqual", value: "2025-05-23" }
  ],
  filterType: models.FilterType.Advanced
};

report.setFilters([dateFilter]);

To confirm if duplicate filters are applied, use report.getFilters() and inspect the array. If you see two entries for the same Date column, that's your confirmation that the slicer and JS are both filtering it. Remove one to restore proper behavior.

 

Best regards,

Helpful resources

Announcements
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.