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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors