Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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")
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:
you may try:
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.
@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.
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
And that will ensure only valid dates are selectable.
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 137 | |
| 102 | |
| 71 | |
| 67 | |
| 64 |