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
mno3nrg
Frequent Visitor

Show migration between sales channels

Hello, I'm new to DAX and I'm unfortunately not getting anywhere at this point. I have a table with sales data. Each sale is assigned to a sales channel. I want to use a Sankey chart to show how customers churn between sales channels when they order multiple times.

My thought was: I use the sales channel column given so far and add another column which contains the sales channel of the next order, if there is another order. So it should show the next sales channel if the customer number stays the same and the column "Order / Customer" grows by 1. Unfortunately I have no idea how to formulate this in DAX.

In Sankey I would use the actual sales channel as the start and the new column as the target. Does this make sense, and what would happen if customers order only once and then the new column remains empty?

Here is my current table with orders:

order_idcustomer_idsales channelorder / customerfollowing sales channel
111Amazon1ebay
211ebay2-
312Amazon1-
413Shop1Amazon
613Amazon2Amazon
713Amazon3-

 

If my approach does not make sense, please feel free to give me a better suggestion. It doesn't matter how, but I would like to be able to show the churn between distribution channels.

Thank you very much!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mno3nrg , In case you need following sales channel, a new column

 

following sales channel =
var _max = minx(filter(Table, [customer_id] =earlier([customer_id]) && [order_id] > earlier([order_id])),[order_id])
return
maxx(filter(Table, [customer_id] =earlier([customer_id]) && [order_id] =_max ),[sales channel])

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@mno3nrg , In case you need following sales channel, a new column

 

following sales channel =
var _max = minx(filter(Table, [customer_id] =earlier([customer_id]) && [order_id] > earlier([order_id])),[order_id])
return
maxx(filter(Table, [customer_id] =earlier([customer_id]) && [order_id] =_max ),[sales channel])

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.