cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ysapiyev Member
Member

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
Community Support Team
Community Support Team

Re: Sync between custom filter and slicer

@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.
Moderator v-viig
Moderator

Re: Sync between custom filter and slicer

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 Member
Member

Re: Sync between custom filter and slicer

@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 

Moderator v-viig
Moderator

Re: Sync between custom filter and slicer

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 Member
Member

Re: Sync between custom filter and slicer

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

Moderator v-viig
Moderator

Re: Sync between custom filter and slicer

Yes, I think so.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

ysapiyev Member
Member

Re: Sync between custom filter and slicer

@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 Member
Member

Re: Sync between custom filter and slicer

@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

Moderator v-viig
Moderator

Re: Sync between custom filter and slicer

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
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (1,290)