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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.