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
Anonymous
Not applicable

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, @Anonymous 

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
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.