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 using direct query and looking to calculate running total of sale after customer purchases promotional product the first time (customer is allowed to purchase promotional product again at later date).
Below is similar to table I have.
Customer | Date | Promo | Sales |
1 | 1/1/2019 | $ 50.00 | |
1 | 1/3/2019 | a | $ - |
2 | 2/4/2019 | $ 2,415.00 | |
2 | 2/7/2019 | a | $ - |
1 | 3/11/2019 | $ 2,152.00 | |
2 | 3/31/2019 | $ 2,341.00 | |
1 | 3/31/2019 | a | $ - |
2 | 3/31/2019 | a | $ - |
1 | 4/1/2019 | $ 435.00 | |
2 | 4/3/2019 | $ 5,334.00 | |
1 | 5/23/2019 | $ 754.00 |
I would like the result to show $3,341 for customer 1 and $7,675 for customer 2 (total sale after customers buys promo product 'a' first time). I am also looking to add summary KPI visual to show overall customers (in this example $11,016).
Any help would be greatly appreciated.
Have a wonderful day.
Solved! Go to Solution.
Hi @Thorgi ,
Please refer to below measures:
first time pur = CALCULATE ( MIN ( Sheet6[Date] ), FILTER ( ALLEXCEPT ( Sheet6, Sheet6[Customer] ), Sheet6[Promo] <> BLANK () ) ) running total = CALCULATE ( SUM ( Sheet6[Sales] ), FILTER ( ALLEXCEPT ( Sheet6, Sheet6[Customer] ), Sheet6[Date] <= MAX ( Sheet6[Date] ) && Sheet6[Date] >= [first time pur] ) )
Best regards,
Yuliana Gu
Hi @Thorgi ,
Please refer to below measures:
first time pur = CALCULATE ( MIN ( Sheet6[Date] ), FILTER ( ALLEXCEPT ( Sheet6, Sheet6[Customer] ), Sheet6[Promo] <> BLANK () ) ) running total = CALCULATE ( SUM ( Sheet6[Sales] ), FILTER ( ALLEXCEPT ( Sheet6, Sheet6[Customer] ), Sheet6[Date] <= MAX ( Sheet6[Date] ) && Sheet6[Date] >= [first time pur] ) )
Best regards,
Yuliana Gu
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 |
---|---|
115 | |
99 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |