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
ratercero
Helper III
Helper III

Conditional duplicate secuence count 2 columns

Hello,

I need to count de sequence a batch number and a description repeats except if description = "OK", here es my current table:table 2.JPG

 

 

 

Here is what I'm looking for:

 

table 3.JPG

 

 

 

 

Thank you

 

2 ACCEPTED SOLUTIONS

Hi @ratercero,

 

I have the March Update and have built a very simple version which I have uploaded here.  Please download and see if it works for you.

 

PBIX file to test


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Hi @ratercero,

 

Please try this slightly modified column.

 

Sequence Count = COUNTROWS(
            FILTER(
                'Table',
                'Table'[BATCH_NUMBER_1]=EARLIER('Table'[BATCH_NUMBER_1]) 
                && 'Table'[DESCRIPTION]<>"ok" 
                && 'Table'[DESCRIPTION] = EARLIER('Table'[DESCRIPTION])
                && 'Table'[c_FinishedDT] <= EARLIER('Table'[c_FinishedDT]
            )
           ))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

7 REPLIES 7
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @ratercero

 

How close is this to your requirements?

 

Sequence Count = COUNTROWS(
            FILTER(
                'Table',
                'Table'[BATCH_NUMBER_1]=EARLIER('Table'[BATCH_NUMBER_1]) 
                && 'Table'[DESCRIPTION]="ok" 
                && EARLIER('Table'[DESCRIPTION]) <> "ok"
            )
           )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hello @Phil_Seamark,

 

Im getting this error:

error 1.JPG

 

 

 

 and the variable does exist:

variable.JPG

 

 

 

 

Hi @ratercero,

 

Are you creating these as calculated columns?  Rather than as measures?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

I tried both and non of them work, you think it has something to do with the march update?

Hi @ratercero,

 

I have the March Update and have built a very simple version which I have uploaded here.  Please download and see if it works for you.

 

PBIX file to test


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark,

 

This is very close to whagt im looking for, but notice on batch "005326" Description "RP" , is twice, so it should count as 2 the second time it shows.

 

 

table4.JPG

Hi @ratercero,

 

Please try this slightly modified column.

 

Sequence Count = COUNTROWS(
            FILTER(
                'Table',
                'Table'[BATCH_NUMBER_1]=EARLIER('Table'[BATCH_NUMBER_1]) 
                && 'Table'[DESCRIPTION]<>"ok" 
                && 'Table'[DESCRIPTION] = EARLIER('Table'[DESCRIPTION])
                && 'Table'[c_FinishedDT] <= EARLIER('Table'[c_FinishedDT]
            )
           ))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.