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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
pfarahani
Helper II
Helper II

DAX Dynamic Filter

Hello All,

 

I have code used for dynamic filter. When the user choose a Year from the Year slicer it will display the chosen years in the visual. But I am trying to add a filter to this code (I dont know where to add it). 

I want to add a filter, something like this: 

FILTER('_JBSIS Probate Dates Year Month','_JBSIS Probate Dates Year Month'[DisplayYear]="1")

 

pfarahani_0-1634344918822.png

 

5 REPLIES 5
Anonymous
Not applicable

Hi @pfarahani ,

 

I have built a data sample, but actually I'm not very clear about your expected output.

 

If you want to filter out DisplayYear<> "Include" as shown below:

Eyelyn9_1-1635317343423.png

 

you may try:

Eyelyn9_0-1635317197619.png

If it does not help you , please describe what you expected in detail to help us clarify your scenario.

 

 

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

AllisonKennedy
Community Champion
Community Champion

@pfarahani  Sorry but I don't know where to add it either with only the info you've provided. What does 'Display Year' mean? What info is in that column? Why does this filter need added to a measure that is designed to show which filters are already applied? 

 

If you can provide more detail, we can be more helpful. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi Allison,

 

Here is the thing, maybe I do not need Display Year=1. I just want the filter so that I can cap the year at a certain point. My years only goes up to 2021 in my model. It would be nice to do it dynamcally (use MAX year from my model). Display Year is an IF expression I wrote, its a calculated column, it displays 1 or 0 depending if I have a data for that year. It would be great if I could add a Filter, MAX year from the table I have that contains data, which goes up to 2021 for now, more years will be added later. 

@pfarahani Is _JBSIS Probate Dates Year Month a DimDate table containing dates beyond those that actually have data? 

 

You could simply add a filter to the page or even filters on all pages sections or to a specific visual (depending on what you want), that says Display Year = 1

 

AllisonKennedy_0-1634353901141.png

 

And that will ensure only valid dates are selectable. 

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi Allison, 

I got a little closer, I created a variable which I tested. I just need to know where to apply the variable. To say, WHERE [Year] <= _MaxYear

 

pfarahani_0-1634411549826.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 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 Solution Authors