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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Kuma64
New Member

How can I check each cel in a column to see if it matches a condition in DAX

I want to filter a table in periods of five years (basically, create a slicer that lets the user choose to see data from the last 5, 10, 15, etc. years).
To accomplish this, I believe the best idea is to create a measure that checks each cell in the date column and determines if it is within the selected period, returning a 1 if true and 0 if not. Then, I want to filter the table using this new column.

The only issue is that I can't seem to find a way to do this.

 

the code would look something like this 

 

filter =

VAR _period = [period]
RETURN
IF('TableYear'[Date] >= _period, 1, 0)

 

basicly take a table like this

pricedate
5401/01/2020
3401/01/2017
75601/01/2016
5401/01/2014
5301/01/2012

 

and if the slicer is the (past 5 years) return this 

 

PriceDateT/F
54 01/01/20201
3401/01/20171
756 01/01/20161
5401/01/20140
5301/01/20120

 

Wish there was a way to use a measure in an advanced filter, but unless it's a Top N filter, there is no option to do so.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You can use a measure as a visual filter. It has to be numeric though, not True/False.

 

Your date range selection must be fed from a disconnected table. Then probe its value(s) with your measure and return 1 or 0.  Add the measure to the visual filters, and set it to "is 1".

View solution in original post

4 REPLIES 4
v-sathmakuri
Community Support
Community Support

Hi @Kuma64 ,

 

I hope this information provided is helpful. Feel free to reach out if you have any further questions or would like to discuss this in more detail. If responses provided answers your question, please accept it as a solution so other community members with similar problems can find a solution faster.

 

Thank you!!

v-sathmakuri
Community Support
Community Support

Hi @Kuma64 ,

 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

 

Thank you!!

v-sathmakuri
Community Support
Community Support

Hi @Kuma64 ,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @lbendlin  for the prompt repsonse.

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you!!

lbendlin
Super User
Super User

You can use a measure as a visual filter. It has to be numeric though, not True/False.

 

Your date range selection must be fed from a disconnected table. Then probe its value(s) with your measure and return 1 or 0.  Add the measure to the visual filters, and set it to "is 1".

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.