Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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:
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
Take a good look at Adding Selection and Interaction with Other Visuals.
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
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
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
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.
Yes, I think so.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
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
I understood how to use advanced filter. However, I've faced new issue:
when I don't use date input, everything works fine:
However, when I use date input, it stops changing.
How it can be fixed?
Regards,
Yerkhan
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
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
37 | |
4 | |
3 | |
2 | |
2 |