Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
manojsv16
Helper II
Helper II

Measure to calculate count of accounts which has 2 or more consecutive bill months

Hello All,

 

I have a requriement to create a measure to calculate the count the accounts which has 2 or more consecutive bill months.

Please help me in getting the total of count of account which has the consective month bills 

 

I would appreciate any help on achieving this.  Also, please let me know if you need any further information from my end. 

 

Example: 

The total count i expected to get from the table below is 6. 

 

Account 11234  has consective bills in Dec-18 to Jan-19,  Mar-19 to Apr 19.  This account doesn't have bill in the month of Feb-19

So the count for Account 11234 is 2 (1 for Dec-18 & Jan-19, 1 for Mar-19 & Apr 19). 

 

Account 87239 has consective bills in Dec-18 to  Mar-19 , May-19 to Jun-19. This account doesn't have bill in the month of Apr-19

So the count for Account 87239 is 2 (1 for Dec-18 to  Mar-19, 1 for  May-19 to Jun-19). 

 

Account 54327 has consective bills in Jan-19 to  Feb-19 , Apr-19 to Jun-19. This account doesn't have bill in the month of Mar-19

So the count for Account 54327 is 2 (1 for Jan-19 to  Feb-19 , 1 for  Apr-19 to Jun-19)

 

 

AccountBill Month
11234Dec-18
11234Jan-19
11234Mar-19
11234Apr-19
87239Dec-18
87239Jan-19
87239Feb-19
87239Mar-19
87239May-19
87239Jun-19
54327Jan-19
54327Feb-19
54327Apr-19
54327May-19
54327Jun-19

 

Thank you!!

1 ACCEPTED SOLUTION

Hey @manojsv16 ,

 

basically the restart of the index is not adding an increment to an exisiting variable under certain circumstances as one might use in different programming languages, this is due to the lack of "real" iterators like for/next or do/while (but we also should not underestimate the power of table iterators).

Instead the reindexing is based on "simple" counting. What's been counted is the number of rows, that is closest (the one the closest to the "current" Month" the "RunningMonthIndex") to the Month that is flagged by the "_check NoValue" Measure. I guess in a way it's valid to say that the "last" blank value interrupts the counting and restarts the index.

 

Hopefully this provides the necessary information you are looking for.

Regards,
Tom

 

P.S.: Maybe you might consider to select one of the posts in this thread as an answer, as this might also help others.

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

20 REPLIES 20

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.