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

Find the Next Product Purchased that is Different from the First

I am trying to do some analysis around the order in which customers purchase products.  I have a table that has customers, date purchased, and product type.  I was able to find the first product purchased using the measure:

 

1st Product=
MAXX(
Topn(1,
Summarize(Contracts,_Date[Date],Contracts[Product Type]),
Calculate(MIN(_Date[Date])),ASC),Contracts[Product Type])
 
My Data looks like this:
 
CustomerDateProduct

Cust 1

11.19.2014Product 1
Cust 14.4.2015Product 1
Cust 18.13.2015Product 4
Cust 18.15.2015Product 4
Cust 19.2.2015Product 3

 

I am trying to write a measure to return product 4 as the second unique product they purchased, and then product 3 as the 3rd in a separate measure.

 

The goal would be to combine the measures to look like this:

 

CustomerProduct Sequence
Cust 1Product 1, Product 4, Product 3

 

Thank you for the help!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Date value = MIN(Data[Date])
Product sequence = CONCATENATEX(TOPN(10,VALUES(Data[Product]),[Date value]),Data[Product], ", ")
Hope this helps.
Untitled.png

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Date value = MIN(Data[Date])
Product sequence = CONCATENATEX(TOPN(10,VALUES(Data[Product]),[Date value]),Data[Product], ", ")
Hope this helps.
Untitled.png

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@ejhornyak , Try like

concatenatex(summarize(Table,Table[customer],Table[Product],"_1",firstnonblankvalue(table[product],min(Table[Date]))),[product])

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.