Forum Discussion
Dax consecutive Count by months
- 4 years ago
Hi Anonymous ,
Please create a date table and the relationship.
Then create these measures:
Measure = IF ( SUM ( 'Table'[Latency Value] ) > SUM ( 'Table'[Target value] ), 1, 0 )Measure2 = VAR tab = SUMMARIZE ( ALLSELECTED ( 'Date' ), 'Date'[Year_Month], "M", [Measure] ) VAR mindate = CALCULATE ( MAX ( 'Date'[Year_Month] ), ALLSELECTED ( 'Date' ), FILTER ( tab, 'Date'[Year_Month] < MAX ( 'Date'[Year_Month] ) && [M] = 0 ) ) RETURN IF ( [Measure] = 1, SUMX ( FILTER ( tab, 'Date'[Year_Month] <= MAX ( 'Date'[Year_Month] ) && 'Date'[Year_Month] > mindate ), [M] ) - 1 )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Please create a date table and the relationship.
Then create these measures:
Measure =
IF ( SUM ( 'Table'[Latency Value] ) > SUM ( 'Table'[Target value] ), 1, 0 )Measure2 =
VAR tab =
SUMMARIZE ( ALLSELECTED ( 'Date' ), 'Date'[Year_Month], "M", [Measure] )
VAR mindate =
CALCULATE (
MAX ( 'Date'[Year_Month] ),
ALLSELECTED ( 'Date' ),
FILTER ( tab, 'Date'[Year_Month] < MAX ( 'Date'[Year_Month] ) && [M] = 0 )
)
RETURN
IF (
[Measure] = 1,
SUMX (
FILTER (
tab,
'Date'[Year_Month] <= MAX ( 'Date'[Year_Month] )
&& 'Date'[Year_Month] > mindate
),
[M]
) - 1
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello v-kkf-msft ,
unbelievable !!
This works just like a magic !
Thank you very much for your help ! 😊✊