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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
aguuzdo
Helper I
Helper I

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
Super User
Super User

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 !!

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

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.