Forum Discussion
Customer purchasing 2 brands over Time
Hi there,
I want to calculate the Customers that purchase both brands over time (not exact by month, can depend on how we choose the x-axis), as well as the customers who purchase brand A over time.
I have got the formula below for Customers purchase both brands, but it doesn't seems right.
could anyone help?
Thanks,
Shayla
- Anonymous2 years ago
Hi shayla ,
Thanks for the reply from Ashish_Mathur .
Please try to create two measures:
A_Brand = CALCULATE( SUM('Sales'[Both Brand]), FILTER(ALL('Sales'),'Sales'[Inv Date] <= MAX('Sales'[Inv Date]) && 'Sales'[Brand] = "A") ) Both_Brand = CALCULATE ( SUM ( 'Sales'[Both Brand] ), FILTER ( ALL ( 'Sales' ), 'Sales'[Inv Date] <= MAX ( 'Sales'[Inv Date] ) ) )The final page effect is as follows:
You have too much data I don't know if the calculations are correct, I created a small example data using the same syntax and got the correct results.
Date
Sales
Year & Month
Sunday, January 1, 2023
100
2023 January
Wednesday, February 1, 2023
200
2023 February
Wednesday, March 1, 2023
150
2023 March
Saturday, April 1, 2023
250
2023 April
Monday, May 1, 2023
200
2023 May
Thursday, June 1, 2023
450
2023 June
Saturday, July 1, 2023
400
2023 July
Tuesday, August 1, 2023
300
2023 August
Friday, September 1, 2023
350
2023 September
Sunday, October 1, 2023
600
2023 October
Wednesday, November 1, 2023
650
2023 November
Friday, December 1, 2023
750
2023 December
Monday, January 1, 2024
700
2024 January
Measure = CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Date] <= MAX('Table'[Date])))The pbix file is attached.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
2 Replies
- Ashish_MathurSuper User
Hi,
What do you mean bby "it does not seem right"? In a simple Table, show the exact numbers that you are expecting.
- AnonymousNot applicable
Hi shayla ,
Thanks for the reply from Ashish_Mathur .
Please try to create two measures:
A_Brand = CALCULATE( SUM('Sales'[Both Brand]), FILTER(ALL('Sales'),'Sales'[Inv Date] <= MAX('Sales'[Inv Date]) && 'Sales'[Brand] = "A") ) Both_Brand = CALCULATE ( SUM ( 'Sales'[Both Brand] ), FILTER ( ALL ( 'Sales' ), 'Sales'[Inv Date] <= MAX ( 'Sales'[Inv Date] ) ) )The final page effect is as follows:
You have too much data I don't know if the calculations are correct, I created a small example data using the same syntax and got the correct results.
Date
Sales
Year & Month
Sunday, January 1, 2023
100
2023 January
Wednesday, February 1, 2023
200
2023 February
Wednesday, March 1, 2023
150
2023 March
Saturday, April 1, 2023
250
2023 April
Monday, May 1, 2023
200
2023 May
Thursday, June 1, 2023
450
2023 June
Saturday, July 1, 2023
400
2023 July
Tuesday, August 1, 2023
300
2023 August
Friday, September 1, 2023
350
2023 September
Sunday, October 1, 2023
600
2023 October
Wednesday, November 1, 2023
650
2023 November
Friday, December 1, 2023
750
2023 December
Monday, January 1, 2024
700
2024 January
Measure = CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Date] <= MAX('Table'[Date])))The pbix file is attached.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!