Forum Discussion
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 hoping to avoid the new OFFSET function as it seems it is not available in Analysis Services on Visual Studio which is what I need to deploy to.
- Anonymous3 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 _timesHow 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 _ RongtieIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
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 _timesHow 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 _ RongtieIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.