Forum Discussion
How to Summarise VAR table - customer purchase analysis
- Anonymous5 years ago
Hi anandav
You can try the measure as below.
Measure:
_Category Only Customers = VAR _T = FILTER ( ADDCOLUMNS ( Sales, "COUNT_", CALCULATE ( DISTINCTCOUNT ( Products[Product Category] ), FILTER ( ALL ( Sales ), Sales[Customer] = EARLIER ( Sales[Customer] ) ) ) ), [COUNT_] = 1 && [SaleDate] >= DATE ( 2021, 01, 01 ) ) VAR _T2 = SUMMARIZE ( _T, [Customer] ) RETURN COUNTX ( _T2, [Customer] )Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
anandav , Try a measure like
countx(filter(
SUMMARIZE(
FILTER(ALL(Sales), Sales[SaleDate] >= DATE(2021, 01,01) )
,Customers[Cust ID]
, "_Count", distinctCOUNT(Products[Category ID])
)
,[_Count] =1
), [Cust ID])
Thank you for the reply.
Using the above DAX I am getting the same value for all Product Categories.
The PBI file is here.
What I need is the Categories where customers have ONLY purchased in that category.
Expected results based on attached PBI file is:
Hope I have explained the requirement clearly.
- Anonymous5 years agoNot applicable
Hi anandav
You can try the measure as below.
Measure:
_Category Only Customers = VAR _T = FILTER ( ADDCOLUMNS ( Sales, "COUNT_", CALCULATE ( DISTINCTCOUNT ( Products[Product Category] ), FILTER ( ALL ( Sales ), Sales[Customer] = EARLIER ( Sales[Customer] ) ) ) ), [COUNT_] = 1 && [SaleDate] >= DATE ( 2021, 01, 01 ) ) VAR _T2 = SUMMARIZE ( _T, [Customer] ) RETURN COUNTX ( _T2, [Customer] )Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- anandav5 years ago
Skilled Sharer
Anonymous
Thanks a lot. That works.
Really appreciate your help.
Ps. Sorryfor the late reply - off work due to some issues.