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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
ysapiyev
Responsive Resident
Responsive Resident

Sync between custom filter and slicer

Hi everyone,

 

I have custom visual which filters date and I also have regular slicer with date with date input and slider.

It looks like this:

 

date dd.png

 

In left I have custom filter which selects specific range and on right I have regular slicer. Even though, I set interaction between them, regular slicer doesn't change.

 

How can I make date input values change and slider, by using my custom visual? 

 

Regards,

Yerkhan

9 REPLIES 9
v-chuncz-msft
Community Support
Community Support

@ysapiyev,

 

Take a good look at Adding Selection and Interaction with Other Visuals.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

How do you apply selection/filter in your custom visual?

The slicer doesn't react on any kind of selection if is's applied via SelectionManager.

 

We would recommend to start using Advanced Filter API.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

ysapiyev
Responsive Resident
Responsive Resident

@v-viig,

 

I'm using selection manager. 

 

To use advanced filter API, I should updateOnRangeSelectionChange formula with my own conditions, right? What it will return?

 

Regards,

Yerkhan 

v-viig
Community Champion
Community Champion

You are correct. The updateOnRangeSelectonChange should be modified but it will return nothing as type is void.

The purpose of this function is to generate an IAdvancedFilter and apply it via applyAdvancedFilter.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

ysapiyev
Responsive Resident
Responsive Resident

@v-viig,

 

I've found some code:

const relativeDateFilter: pbi.models.IRelativeDateFilter = {
  $schema: "http://powerbi.com/product/schema#relativeDate",
  target: {
    table: "Sales",
    column: "OrderDate"
  },
  operator: pbi.models.RelativeDateOperators.InLast,
  timeUnitsCount: 30,
  timeUnitType: pbi.models.RelativeDateFilterTimeUnit.Days,
  includeToday: true,
  filterType: pbi.models.FilterType.RelativeDate
};

Can I use it in filter? I want to be able to select last week. month, year.

 

Regards,

Yerkhan.

v-viig
Community Champion
Community Champion

Yes, I think so.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

ysapiyev
Responsive Resident
Responsive Resident

@v-viig,

 

I'm quite confused about usage of Advanced filter. 

 

In updateOnRangeSelectonChange there are several functions, which are located in sampleslicer.ts. Should I copy them to my code? Are they necessary? 

 

I also tried to build filter using powerbi-models but import of powerbi-models failed with error: "import cannot have reference to module". How it can be resolved?

 

Regards,

Yerkhan

ysapiyev
Responsive Resident
Responsive Resident

@v-viig,

 

I understood how to use advanced filter. However, I've faced new issue:

when I don't use date input, everything works fine:

date_1.pngdate_2.png

 

However, when I use date input, it stops changing.

date_3.png

 

How it can be fixed?

 

Regards,

Yerkhan

v-viig
Community Champion
Community Champion

Could you please clarify what data input is? Are you talking about Power BI Slicer?

 

Currently we would recommend to open Chrome Developer Tools and turn on "Pause on exceptions" in the Sources tab.

After that, try to replicate the issue and see if debugger will catch an exception in the code.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.

Top Kudoed Authors