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
Anonymous
Not applicable

Only count rows if the value appears 5 times or more after it.

Hello everyone

 

I have a column with 1's and 0's in it and i am trying to create a measure that looks in my column and only counts as 1 if there are 5 or more rows after it that also have the same value.

 

Is it possible to create such a measure?

 

Any help is greatly apprenticed.

2 REPLIES 2
Greg_Deckler
Super User
Super User

Is there some sort of identity column (ID) or anything? How is this measure being used in a visual? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler 

My mistake. I see now that some information is missing.

 

I have a table that, in a simplified version, looks like this:

Tabel 100.png

The Value column is a calculated column that makes a check and outputs 0 or 1.

 

When there has been a 1 five times in a row or more, it begins to count them together. See the example below.

Tabel 101.png

When the group of 1’s is broken by a 0, it stops counting and looks for the next row with a minimum of five 1’s.

 

Another solution could be to copy the 1’s that is in a group of at least five into a new column and then sum them up afterwards?

 

Thanks

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.