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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
mnt23
Helper I
Helper I

Create "current status" from series of rows time stamping when status changes

Hi all, 

 

I have a scrubbed version of my data (unique ID, date and status) here

 

The data tracks membes of my team as the deploy to a task, are employed on, the task ends and they are then recovered back to their home office. 

 

This is stored as a series of rows - i.e. whenever an individual's status changes (and sometimes when it doesn't) a new row is created with a date and the status that they have changed to. This is all held together by a Unique ID - this ID is unique to an individual and the task, not to each row. 

 

I'd like to be able to plot the number of individuals for any given status, over time. I have a date dimension table already, I think all I need to do is work out how to calculate the measure to plot but I could be wrong. 

 

Any thoughts? I think it will look like some sort of if statement checking statuses and dates but cannot get my had around actually writing it. 

 

Matt

4 REPLIES 4
Anonymous
Not applicable

Hi  @mnt23 ,

I created some data:

vyangliumsft_0-1659338037359.png

Here are the steps you can follow:

1. Create measure.

Measure =
CALCULATE(
    DISTINCTCOUNT('True'[Unique ID]),
    FILTER(ALL('True'),
    'True'[Daily Update Date]=MAX('True'[Daily Update Date])&&
    'True'[Daily Update Status]=MAX('True'[Daily Update Status])))

2. Create calculated column.

Column =
var _index=
CALCULATE(
    MAX('True'[Daily Update Status]),FILTER(ALL('True'),
    'True'[Unique ID]=EARLIER('True'[Unique ID])&&'True'[Daily Update Date]=EARLIER('True'[Daily Update Date])))
var _index_1=
CALCULATE(
    MAX('True'[Daily Update Status]),FILTER(ALL('True'),
    'True'[Unique ID]=EARLIER('True'[Unique ID])&&'True'[Daily Update Date]=EARLIER('True'[Daily Update Date])-1))
    return
IF(
    'True'[Daily Update Date]=MINX(FILTER(ALL('True'),'True'[Unique ID]=EARLIER('True'[Unique ID])),[Daily Update Date]),'True'[Daily Update Status],
    IF(
    _index<>_index_1,'True'[Daily Update Date]&" "&_index_1&" -> "&_index,'True'[Daily Update Status]))

3. Create two pages.

Page1;

vyangliumsft_1-1659338037361.png

Page2:

vyangliumsft_2-1659338037364.png

4. Use the link below to turn Page2 into a Tooltip.

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-tooltips?tabs=powerbi-desktop

5. Result:

When you move the mouse to a date in Page1, the Status conversion data of Page2 will be displayed:

vyangliumsft_3-1659338037366.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi Lui,

 

Thanks for coming back to me. I'm struggling to understand what you've done, are you able to quickly explain it for me?

amitchandak
Super User
Super User

@mnt23 , refer if my blog on a similar topic can help

https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi amitchandak, 

 

That does give me the latest status of each individual, but it doesn't enable me to plot that status over time - if I try and add it to a visualisation like a stacked bar chart against time, it simply doesn't let me add it to the values box.

 

What I'm aiming for is a chart that has date along the bottom, and can then plot the total number of individuals, by status, for each day. 

 

Unfortuntely i don't quite understand how your measure works, so I'm struggling to change it. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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