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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Anonymous
Not applicable

Creating filter column that puts a flag en every record if there were 4 consecutive same categories

Hello everyone, I'm trying to create a calculated column in a table to then use it as a filter in a report.

I have two posible categories "A" and "B", I need to put a yes in the calculated column if I have four consecutive A´s for the same name (in each of the rows with the consecutive A's, furthermore, if there are more than 4 consecutive A's, this rows should also get yes as a result. 

 

Following a table example with the column flag showing the expected result for this calculated column:

datenamecategoryflag
01-01-23OscarAyes
02-01-23OscarAyes
03-01-23OscarAyes
04-01-23OscarAyes
05-01-23OscarAyes
01-01-23JuanBno
02-01-23JuanBno
03-01-23JuanBno
04-01-23JuanAno
05-01-23JuanBno
01-01-23BryanBno
02-01-23BryanBno
03-01-23BryanBno
04-01-23BryanBno
05-01-23BryanAyes
06-01-23BryanAyes
07-01-23BryanAyes
08-01-23BryanAyes
01-01-23JessicaAno
02-01-23JessicaAno
03-01-23JessicaBno
04-01-23JessicaAyes
05-01-23JessicaAyes
06-01-23JessicaAyes
07-01-23JessicaAyes

 

Thanks very much in advance.

2 REPLIES 2
johnyip
Solution Sage
Solution Sage

Do you need to have this calculated column do the calculation based on the row order of your raw data, or the order the records are displayed in a table/matrix vis?



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!
Anonymous
Not applicable

hi, the order of the records is based on the date column

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 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.