Forum Discussion
nascarfan22
1 year agoRegular Visitor
DAX help calculating Repeat Customers
Hi, I’m working in Power BI and trying to create a DAX formula to classify purchasers as either Repeat Customers or Single Customers based on their Customer ID and the dates they made purchases. Fo...
- 1 year ago
hello nascarfan22
i am using your sample data above, please try if this match to your need.
1. create a calculated column to check single or repeat.
Check =
var _Count =
COUNTX(
FILTER(
'Table',
'Table'[Customer ID]=EARLIER('Table'[Customer ID])&&
'Table'[Sales Date]<>EARLIER('Table'[Sales Date])
),
'Table'[Customer ID]
)
Return
IF(
_Count=1,
"Repeat",
"Single"
)2. create two measures for single and repeat
Single =
CALCULATE(
DISTINCTCOUNT('Table'[Customer ID]),
'Table'[Check]="Single"
)Repeat =
CALCULATE(
DISTINCTCOUNT('Table'[Customer ID]),
'Table'[Check]="Repeat"
)Hope this will help.Thank you.
V-yubandi-msft
Community Support
1 year agoHi nascarfan22 ,
Thank you for posting your query in the Microsoft Fabric Community.
Irwan , has provided a detailed response that aligns with your requirements. Could you please review his guidance along with the provided PBIX file.
If you need any further clarification or additional support, feel free to let us know we’re ready to assist.
Best regards,
Yugandhar.