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
Anonymous
Not applicable

Advanced filter for array selection

Hello everybody,

 

I wanted to use advanced filter for array selection, but I have some difficulties. I used following code for date selection:

this.applyDatePeriod(this.start_var, this.end_var, target, true);

public applyDatePeriod(startDate: Date, endDate: Date, target: IFilterColumnTarget, isUserSelection: boolean): void {
            this.applyFilter(isUserSelection);

            // If startDate and EndDate is null then ClearSelection is triggered
            const filter: IAdvancedFilter = new window["powerbi-models"].AdvancedFilter(
                target,
                "And",
                {
                    operator: "GreaterThan",
                    value: startDate
                        ? startDate.toJSON()
                        : null
                },
                {
                    operator: "LessThan",
                    value: endDate
                        ? endDate.toJSON()
                        : null
                });

            this.host.applyJsonFilter(
                filter,
                "general",
                "filter",
                (startDate && endDate)
                    ? FilterAction.merge
                    : FilterAction.remove
            );
        }

 

How can I use same approach for array selection?

Thanks.

 

Regards,

Yerkhan

1 ACCEPTED SOLUTION

@Anonymous ,

 

It seems there's no "array" section in the advanced filter object model. You can refer to the model source code.

https://microsoft.github.io/PowerBI-visuals/tutorials/building-slicer-visual/using-the-advanced-filt...

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

You can refer to the sample code here.

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-yuta-msft Hello

Thanks for your answer. But this is not exactly what I'm looking for. I need custom visual.

Regards,

Yerkhan

@Anonymous ,

 

It seems there's no "array" section in the advanced filter object model. You can refer to the model source code.

https://microsoft.github.io/PowerBI-visuals/tutorials/building-slicer-visual/using-the-advanced-filt...

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

@v-yuta-msft 

Ok, I got it. Thanks anyway.

Regards,

Yerkhan

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