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.
Hello Everyone,
I am stuck at a level of my analysis and need some support 🙂
I am currently trying to answer the following question :
After a new customer purchase a specific product A do the same customer purchase the product B ?
My table looks as follow :
Date | Transaction ID | Item | quantity | price | |
21/05/2018 | 1254jkj578 | community@gmail.com | 2546 | 1 | 8 |
22/05/2018 | 1254jkj579 | community@gmail.com | 2546 | 1 | 8 |
23/05/2018 | 1254jkj580 | community@gmail.com | 2546 | 1 | 8 |
24/05/2018 | 1254jkj581 | community@gmail.com | 2546 | 1 | 8 |
25/05/2018 | 1254jkj582 | community@gmail.com | 2546 | 1 | 8 |
26/05/2018 | 1254jkj583 | community@gmail.com | 2546 | 1 | 8 |
I used a measure from the member community :
Solved! Go to Solution.
Hi @Anonymous
You may create below measures.Then use Final measure in the visual level filter to get the customers that buy product A as first product buy after the product B as second product.
Rank = RANKX(FILTER(ALL(Table1),Table1[Email]=MAX(Table1[Email])),CALCULATE(MAX(Table1[Date])),,ASC)
SecondProduct = CALCULATE(COUNTROWS(Table1),FILTER(ALLEXCEPT(Table1,Table1[Email]),[Rank]=2&&Table1[Product]="B"))
FirstProduct = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( Table1, Table1[Product] = "A" && Table1[Date] = MINX ( FILTER ( ALL ( Table1 ), Table1[Email] = MAX ( Table1[Email] ) ), Table1[Date] ) ) )
Final = IF([FirstProduct]=1&&[SecondProduct]=1,1)
Regards,
Hi,
Share some data and show the expected result. Your original table does not have a product column.
Hi @Anonymous
You may try to create the measure like below:
Measure = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( Table1, Table1[Product] = "A" && Table1[Date] = MINX ( FILTER ( ALL ( Table1 ), Table1[Email] = MAX ( Table1[Email] ) ), Table1[Date] ) ) )
Regards,
Hello Cherie Chen,
Thank you for your reply !!
Unfortunatly when i use both measure ( the one i showed and yours) it's not working at all, i get an error message...
I want to show on a table that customers that buy product A as first product buy after the product B or Not...
Thank you.
Ilhame
Hi @Anonymous
You may create below measures.Then use Final measure in the visual level filter to get the customers that buy product A as first product buy after the product B as second product.
Rank = RANKX(FILTER(ALL(Table1),Table1[Email]=MAX(Table1[Email])),CALCULATE(MAX(Table1[Date])),,ASC)
SecondProduct = CALCULATE(COUNTROWS(Table1),FILTER(ALLEXCEPT(Table1,Table1[Email]),[Rank]=2&&Table1[Product]="B"))
FirstProduct = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( Table1, Table1[Product] = "A" && Table1[Date] = MINX ( FILTER ( ALL ( Table1 ), Table1[Email] = MAX ( Table1[Email] ) ), Table1[Date] ) ) )
Final = IF([FirstProduct]=1&&[SecondProduct]=1,1)
Regards,
Hi,
Sorry for my late reply ...
It's worked !!!
thank you so much for the help !!
ilhame
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |