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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
grggmrtn
Post Patron
Post Patron

Need a visualisation to show change over time - Sankey?

Our data looks more or less like this:

 

 

Person	Service		Startdate	Stopdate
1	Support		01-01-2016	02-10-2018
2	Training	05-12-2017	12-12-2018
3	Housing		03-03-2005	07-08-2010
4	Vehicle		06-12-2015	31-12-9999
5	Meeting		12-05-2014	12-10-2015
1	Training	03-10-2018	01-01-2019
2	Housing		13-12-2018	29-01-2019
3	Housing		08-08-2010	05-02-2018

 

The same person in two different periods, can receive two different services, like person 1 and 2, or the person can continue with the same service in two different periods, such as person 3.
 
It wasn't a problem to create a simple line chart showing how many people received the different services over time (I've combined the start and end dates into a period using M). So - Axis = "date", legend = "Service", value = number of "Person". Boom.
 
But I'd also like to show movement. So - something like the what I have in my line chart, but which would ALSO show at the same time the number of "Person" who changed from the service "Support" to "Housing", or another Service, so we can follow trends/needs etc.
 
I was considering Sankey, but I'm kind of lost there. Any ideas?

 

1 ACCEPTED SOLUTION
grggmrtn
Post Patron
Post Patron

I actually found a work around myself. I don't know if it was the BEST solution, but like I said, it works 🙂

 

I started by creating a column in M that combined [Person] and [Startdate], meaning I would be able sort first by person, then by date.

 

    #"Insert combined column" = Table.AddColumn(#"Ændret type1", "Sorting column", each Text.Combine({[Person], Text.From([Startdate], "da-DK")}), type text),

Then I sorted that column, ascending, and removed it afterwards. Then I added an index column, starting with 0.

 

This gave me the possibility to use [Service] as my source column for Sankey, while using the index column to create a type of relative reference.

 

Then in DAX, I created the destination column:

 

Destination = 
IF (
    'Sankey'[Person]
        = LOOKUPVALUE (
            'Sankey'[Person];
            'Sankey'[Indeks]; 'Sankey'[Indeks] + 1
        );
    'Sankey'[Source];
    "Stopped"
)

 

This gave me a column that returned [Service] if [Person] in the index row below the current row was equal to [Person] in the current row. 

 

I don't know if I explained it very well, but it works. I'm happy. I can move on to the next steps 🙂

View solution in original post

5 REPLIES 5
maxxmilo
Helper I
Helper I

Hi @grggmrtn! Could you kindly post an example image of the sankey chart you ended up with? I'm interested in something similar. Thank you!

grggmrtn
Post Patron
Post Patron

I actually found a work around myself. I don't know if it was the BEST solution, but like I said, it works 🙂

 

I started by creating a column in M that combined [Person] and [Startdate], meaning I would be able sort first by person, then by date.

 

    #"Insert combined column" = Table.AddColumn(#"Ændret type1", "Sorting column", each Text.Combine({[Person], Text.From([Startdate], "da-DK")}), type text),

Then I sorted that column, ascending, and removed it afterwards. Then I added an index column, starting with 0.

 

This gave me the possibility to use [Service] as my source column for Sankey, while using the index column to create a type of relative reference.

 

Then in DAX, I created the destination column:

 

Destination = 
IF (
    'Sankey'[Person]
        = LOOKUPVALUE (
            'Sankey'[Person];
            'Sankey'[Indeks]; 'Sankey'[Indeks] + 1
        );
    'Sankey'[Source];
    "Stopped"
)

 

This gave me a column that returned [Service] if [Person] in the index row below the current row was equal to [Person] in the current row. 

 

I don't know if I explained it very well, but it works. I'm happy. I can move on to the next steps 🙂

grggmrtn
Post Patron
Post Patron

This might be a bit tough to explain, but I'll do my best 🙂

 

Our data looks more or less like this:

 

Person	Service		Startdate	Stopdate
1	Support		01-01-2016	02-10-2018
2	Training	05-12-2017	12-12-2018
3	Housing		03-03-2005	07-08-2010
4	Vehicle		06-12-2015	31-12-9999
5	Meeting		12-05-2014	12-10-2015
1	Training	03-10-2018	01-01-2019
2	Housing		13-12-2018	29-01-2019
3	Housing		08-08-2010	05-02-2018

The same person in two different periods, can receive two different services, like person 1 and 2, or the person can continue with the same service in two different periods, such as person 3.

 

It wasn't a problem to create a simple line chart showing how many people received the different services over time (I've combined the start and end dates into a period using M). So - Axis = "date", legend = "Service", value = number of "Person". Boom.

 

But I'd also like to show movement. So - something like the what I have in my line chart, but which would ALSO show at the same time the number of "Person" who changed from the service "Support" to "Housing", or another Service, so we can follow trends/needs etc.

 

I was considering Sankey, but I'm kind of lost there. Any ideas?

Greg_Deckler
Community Champion
Community Champion


Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks for your help Greg, but it's not quite what I'm looking for. My problem isn't with the dates, it's with creating a source and destination table that will work in Sankey based on the dates.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.