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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mvgust
Helper III
Helper III

Flag column to filter data

All,

 

I need to create a filter to display only records that meet the below criteria.  If an employee has adjusted their timecard for a week ending date, I only want to see the records for those employees who've made changes. Below is visual of what I'd like to achieve. 

 

employee flag.png

 

Thank you.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@mvgust - 

Flag Column = 
  VAR __Name = [EmpName]
  VAR __Week = [WeekEnding]
RETURN
  IF(MAXX(FILTER(ALL('Table'),[EmpName]=__Name && [WeekEnding]=__Week),[Version])>1,TRUE(),FALSE())

Flag Measure = 
  VAR __Name = MAX([EmpName])
  VAR __Week = MAX([WeekEnding])
RETURN
  IF(MAXX(FILTER(ALL('Table'),[EmpName]=__Name && [WeekEnding]=__Week),[Version])>1,TRUE(),FALSE())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@mvgust - 

Flag Column = 
  VAR __Name = [EmpName]
  VAR __Week = [WeekEnding]
RETURN
  IF(MAXX(FILTER(ALL('Table'),[EmpName]=__Name && [WeekEnding]=__Week),[Version])>1,TRUE(),FALSE())

Flag Measure = 
  VAR __Name = MAX([EmpName])
  VAR __Week = MAX([WeekEnding])
RETURN
  IF(MAXX(FILTER(ALL('Table'),[EmpName]=__Name && [WeekEnding]=__Week),[Version])>1,TRUE(),FALSE())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you @Greg_Deckler for providing me 2 different options, the column is going to work better for my scenario and it worked perfectly!

 

I've been struggling to learn DAX - do you have any resources to suggest?  I'm ok at very simple DAX functions but what you provided I would have never even thought of.

 

Thank you!

@mvgust - There's an Introduction to DAX section here: https://docs.microsoft.com/en-us/power-bi/guided-learning/

 

Radacad has some great stuff. https://radacad.com/

 

If you are coming from SQL, @Phil_Seamark 's DAX book is great. I think he has a new one Pro DAX too. I haven't read that one yet but if it's from Phil, it's gold.

 

@MattAllington has some great DAX books

 

@marcorusso 's  Definitive Guide to DAX is, well, it's the gold standard. Maybe a bit theory heavy but unbeatable in terms of coverage of the DAX language.

 

I like my book, DAX Cookbook, as a more practical guide, not nearly so much theory as just straight-up practical DAX implementation strategies for metics, KPI's, etc. to solve real world problems.

 

Another great resource is the Quick Measures Gallery: https://community.powerbi.com/t5/Quick-Measures-Gallery/bd-p/QuickMeasuresGallery?sortby=kudos

 

A lot of my stuff ends up in there. Lots of crazy inventive DAX.

 

Very much depends what you are into, how you learn, etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.