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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
BIsteht
Helper III
Helper III

Count number of times a value changes from a specific value to another specific value

Hi - I have the following scenario I am tying to solve.

 

  1. We need to track the number of times a customer status changes from one specific status (Active) to any other status (Inactive, Onboarding, Canceled).
  2. We need the ability to set a date filter and have the count adjust to the number of changes within the filtered range
  3. This need to be calculated at the customer level.
  4. There could be a different field updated, causing an additonal history record in the table where the status field is unchanged (lines 2 and 3 below from 1/2/2019).

Screenshot_1.png

 

 

 

 

 

 

 

 

 

 

 

 

The 'flag' column above is basically what we need to complish. Each time the status changes from Active to another status, we need to 'flag' it. So, customer 1 is flagged on 1/2/2019 and 2/5/2019. If we set a date filter to january 2019, we would have a count of 1 for customer 1.

 

I've seen one simliar question and solution but it does not contain a group by clause (customer in this case). Any help would be much appreciated.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

This is a problem that involves EARLIER. See my article on Mean Time Between Failure (MTBF) which uses EARLIER (and "group by" essentially: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

This is a problem that involves EARLIER. See my article on Mean Time Between Failure (MTBF) which uses EARLIER (and "group by" essentially: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler ,

Thanks for the nudge. Your blog plus a little help from the link below got me to the end result I needed.

 

https://powerpivotpro.com/2015/03/how-to-compare-the-current-row-to-the-previous-row-in-power-pivot/

 

Thanks again!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.