Forum Discussion
oberthju
Advocate III
7 years agoDAX - how to count consecutive identical values ?
Hi, I would need a DAX formula to calculate the Result column which is the total number of consecutive 1 in Value columns, starting from current month descending. I'm sure you know :smileyhappy...
- 7 years ago
Hello, thanks for your replies, I finally found my way of doing it.
Hope this helps.
nb consecutive months to date =
VAR month =
CALCULATE (
MAX ( Table1[mois] );
FILTER (
CALCULATETABLE ( Table1; ALL ( Table1 ); Table1[valeur] = 0 );
Table1[mois] <= EARLIER ( Table1[mois] )
)
)
RETURN
CALCULATE (
COUNTROWS ( Table1 );
FILTER (
Table1;
Table1[mois] <= EARLIER ( Table1[mois] )
&& Table1[mois] > month
)
) + 0
TomMartens
Super User
7 years agoHey,
as indexing sequences is not as easy as it should :-) please have a look at this thread and try to adapt my answer(s) to your data: https://community.powerbi.com/t5/Desktop/Measure-to-calculate-count-of-accounts-which-has-2-or-more/td-p/638679/page/2
If you need more help, please create a pbix file that contains sample data, upload the file to onedrive or dropbox and share the link.
Regards,
Tom