Forum Discussion
Please Help! For each Serial Number i need to count the days its consecutively Active
- Anonymous3 years ago
Hi LynnG ,
I have created a simple sample, please refer to it to see if it helps you.
Create measures.
flag = VAR _a = CALCULATE ( MAX ( 'Table'[summary_date] ), FILTER ( ALLEXCEPT ( 'Table', 'Table'[Serial Number] ), [summary_date] < MAX ( 'Table'[summary_date] ) ) ) VAR _b = MAX ( 'Table'[summary_date] ) - 1 RETURN IF ( _a <> _b, 0, 1 )minflagdate = CALCULATE ( MAX ( 'Table'[summary_date] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[summary_date] <= SELECTEDVALUE ( 'Table'[summary_date] ) && [flag] = 0 && 'Table'[Serial Number] = SELECTEDVALUE ( 'Table'[Serial Number] ) ) )result = DATEDIFF([minflagdate],MAX('Table'[summary_date]),DAY)+1How 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 _ PollyIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi LynnG ,
I have created a simple sample, please refer to it to see if it helps you.
Create measures.
flag =
VAR _a =
CALCULATE (
MAX ( 'Table'[summary_date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Serial Number] ),
[summary_date] < MAX ( 'Table'[summary_date] )
)
)
VAR _b =
MAX ( 'Table'[summary_date] ) - 1
RETURN
IF ( _a <> _b, 0, 1 )
minflagdate =
CALCULATE (
MAX ( 'Table'[summary_date] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[summary_date] <= SELECTEDVALUE ( 'Table'[summary_date] )
&& [flag] = 0
&& 'Table'[Serial Number] = SELECTEDVALUE ( 'Table'[Serial Number] )
)
)
result = DATEDIFF([minflagdate],MAX('Table'[summary_date]),DAY)+1
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 _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much!! This worked perfectly!!