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

View all the Fabric Data Days sessions on demand. View schedule

Reply
RandomJoe
Frequent Visitor

How do you create an "OR" filter?

Power BI filters are this "AND"ing of fields. You can apply the setup of filters for the visual, for the Page, or for the Report.

What if you have "OR" logic you need to handle. Take the following example:

 

 

Last Login > X

Last Login < X

Completed = Yes

Include

Include

Completed = No

Exclude

Include

 

There are a bunch of records to include, but when two conditions occur then exclude those records.

 

Secondly, I want the date (X) to be variable like from a time slicer.

 

How is this best done in Power Bi? I’m guessing this will be a new column.

5 REPLIES 5
az38
Community Champion
Community Champion

Hi @RandomJoe 

for  your scenario its better to use DAX logic.

for example, you can create calculated column like, then filter by its value

filterFlag = 
SWITCH(TRUE(),
[Completed] = "Yes", "Include",
[Completed] = "No" && [Last Login] > [X], "Exclude",
"Include"
)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
amitchandak
Super User
Super User

Please share some sample data and expected results

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Today = 2/3/2020

Example:

X = 30 days

 
   
Last LoginCompletedResult
1/1/2020NoExclude
1/1/2020YesInclude
1/2/2020NoExclude
1/2/2020YesInclude
1/4/2020NoInclude
1/4/2020YesInclude
1/21/2020NoInclude
1/22/2020YesInclude
Anonymous
Not applicable

Measure=If(table[completed]="yes" || max(table[last login])&gt;today(),"include","exclude")

Thanks,
Pravin

If it resolves your problem mark it as a solution and give Kudos.

Try

 

Measure = if(Sumx(Sheet1,if(Sheet1[Last Login]>=maxx('Date',DATEADD('Date'[Date],-30,DAY)),1,if(Sheet1[Last Login]<maxx('Date',DATEADD('Date'[Date],-30,DAY)) && Sheet1[Completed] ="Yes",1,0)))=1,"Include","Exclude")

 

Link :https://www.dropbox.com/s/jl2jjl9v2g8tabu/include_exclude.pbix?dl=0

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors