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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
readyraddy
Helper I
Helper I

Consecutive Zero Values

Hi all,

 

I have a table of data as shown below. I would like to count the consecutive number of days(5days) where the value of 'Operation' is Zero. The consecutive days should be unique to the 'Location' & 'Status2'.

 

Screenshot 2019-11-26 at 5.43.16 PM.png

 

Desired Output:

 

I filtered the data to better visualise the desired output. In this case, an additional column has been added to count the consecutive days where the value of 'Operation' is zero. 

Screenshot 2019-11-26 at 5.54.55 PM.png

 

Hope to get some help here. Thanks!

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @readyraddy ,

 

Here I have created a sample for your reference. 

Measure = 
VAR a =
    MAX ( 'Table'[DateTime] ) - 5
VAR b =
    MAX ( 'Table'[DateTime] )
VAR cov =
    CALCULATE (
        SUM ( 'Table'[Operation] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Location], 'Table'[Status2] ),
            'Table'[DateTime] > a
                && 'Table'[DateTime] <= b
        )
    )
RETURN
    IF ( cov = 0, 1, BLANK () )
Measure 2 = 
CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', [Measure] = 1 ) )

Capture.PNG

 

For more details, please check the pbix as attached.If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

1 REPLY 1
v-frfei-msft
Community Support
Community Support

Hi @readyraddy ,

 

Here I have created a sample for your reference. 

Measure = 
VAR a =
    MAX ( 'Table'[DateTime] ) - 5
VAR b =
    MAX ( 'Table'[DateTime] )
VAR cov =
    CALCULATE (
        SUM ( 'Table'[Operation] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Location], 'Table'[Status2] ),
            'Table'[DateTime] > a
                && 'Table'[DateTime] <= b
        )
    )
RETURN
    IF ( cov = 0, 1, BLANK () )
Measure 2 = 
CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', [Measure] = 1 ) )

Capture.PNG

 

For more details, please check the pbix as attached.If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.