Forum Discussion

JAJ09's avatar
JAJ09
New Member
3 years ago
Solved

Need help to count periods with the same data

Hi there, I am trying to count periods in which a specific condition is active but the count restarts if the data changes in the time sequence   Example of data and expected data:   I am ho...
  • Anonymous's avatar
    Anonymous
    3 years ago

    hI JAJ09 ,

    I have created a simple sample, please refer to my pbix file to see if it helps you.

    Create a measure.

    MEASURE = 
    VAR _date =
        CALCULATE (
            MAX ( 'Table'[period] ),
            FILTER (
                ALL ('Table' ),
                'Table'[Type] <> "V"
                    && 'Table'[period] <= SELECTEDVALUE('Table'[period]) 
                    
        ))     
    VAR _times =
        CALCULATE (
            COUNTROWS ('Table'),
            FILTER (
                ALL ( 'Table' ),
                'Table'[period] <= SELECTEDVALUE('Table'[period])
                    &&'Table'[period] > _date
                    
            )
        ) + 0 
    RETURN
        _times

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.