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
danial_mcgreevy
Frequent Visitor

DAX Counting Groups of Repetition in Row

Hey

 

Not long into my DAX understanding and i've hit a brickwall.

 

I need to create a measure that counts if a RANDOM_PERSON_ID is repeated 5 times.

 

So, my measure value with the test dataset should be 1 (9662AF155704B3F7).

 

Capture.PNG

 

Note that the table is on a Tabular Cube and does not have a uniqueidentifier and has about 46 million records. 

 

Any help greatly appreciated.

 

Thanks

 

Danny

 

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@danial_mcgreevy , Try this measure with RANDOM_PERSON_ID in a visual

countx(filter(summarize(table,table[RANDOM_PERSON_ID], "_1",count(*)), [_1]>=5),[RANDOM_PERSON_ID])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@danial_mcgreevy , Try this measure with RANDOM_PERSON_ID in a visual

countx(filter(summarize(table,table[RANDOM_PERSON_ID], "_1",count(*)), [_1]>=5),[RANDOM_PERSON_ID])

Huge thanks.

 

Slight amendment to handle strings but works a charm.

 

COUNTAX (
FILTER (
SUMMARIZE (
Table,
Table[RANDOM_PERSON_ID],
"EqualTo5", COUNTA ( Table[RANDOM_PERSON_ID] )
),
[EqualTo5] = 5
),
Table[RANDOM_PERSON_ID]
)

 

Kind regards

 

Dannt

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.

Top Solution Authors