cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JD09631
Helper II
Helper II

Calculate consecutive decreases over time?

Hi, hopefully someone can help with this? I have a table that looks like the below

Client_IDYearMonthTickets_Created
10442019Jul92
10442019Aug65
10442019Sep33
10442019Oct12
10442019Nov10
10442019Dec2

What I want to do is analyze Client_IDs who have a consecutive Tickets_Created on a month by month basis.  To do this I created a calculated column which compared the current month to the previous month

Client_IDYearMonthTickets_CreatedDifference
10442019Jul92-2
10442019Aug65-27
10442019Sep33-32
10442019Oct12-20
10442019Nov10-2
10442019Dec2-8

Now what I want is using the above, get a table that shows the top ten Client_IDs that have the most consecutive months decrease in tickets. So for example, the above Client_ID would have a consecutive decrease of 6 months. If the same Client_ID had an increase this month (compared to November) then they would no longer show on the top 10 table as this would reset the conescutive months they have decreased.

I hope this makes sense? Appreciate any help

1 REPLY 1
V-pazhen-msft
Community Support
Community Support

Hi, @JD09631 

I have spend some time together with experts using some random sample. We found that you can make the consecutive count, but the tricky part is you have to re-count each time when there is increase in the tickets.

I am afraid that DAX do not support this kind of calculation, maybe try with power query.

This is my consecutive count formula if needed: 

 

Count concecutive decrease =
IF (
    [Differece] < 0,
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( ALLEXCEPT ( 'Table', 'Table'[Client_ID] ), [Differece] < 0 ),
        'Table'[Month] <= EARLIER ( 'Table'[Month] )
    ) + 0,
    BLANK ()
)

 


Best
Paul

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors