Forum Discussion

Noredlac86's avatar
Noredlac86
Icon for Helper I rankHelper I
3 years ago
Solved

Count if consecutive values DAX

Hi Team.

I was wondering if you can help me with this question


I have two 3 columns, i need to count how many time show "Yes" in each ID in the consecutive order months:

MonthNo    ID   Value
12                001   Yes
11                001   Yes
10                001   Yes
9                  001   Yes
12                002   Yes
10                002   Yes
12                003   Yes
11                003  No

Results:
ID 001= 4 
ID 002= 2
ID 003 =0


The column Month wont have all months,  for example the ID002, only have month 12 and 10, thise month are consecutive cause mont 11 does not show, does mean that if we have 1,3,5,10. This is also consecutive

What formula can i use?

  • Hi Noredlac86 ,

    The Value column is the column with the data "Yes" or "No". 

    From your error message, I guess you use it as a measure. You can download my sample below to see the details.

     

    Best Regards,
    Community Support Team _ kalyj

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