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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.