Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
test14
Contributor II
Contributor II

Sum of one column if Distinct count of another column is >1

Hi guys,

I was using the following to calculate the YTD Revenue of our repeat customers:

Sum({<Year=,Quarter=,Month=,Week=,[OrderDate]=,DateKey={">=$(=Num(YearStart(Max(DateKey))))<=$(=Max(DateKey))"},format-={'Null()'}, CustomerType= {'repeat'}>}revenue)

There was an issue with the CustomerType flag, so now i need to count the distinct order_IDs to group customers into first time and repeat customers.

I want to include that into the calculation. The initial expression sums the revenue of CustomerType = repeat.
Now I want to sum the revenue of customers that have more than one distinct order:

Count(DISTINCT order_id)>1

How can I replace that with CustomerType= {'repeat'}?
I can't get it to work.

Thanks in advance

1 Solution

Accepted Solutions
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @test14, why don't you try with:

CustomerID = {"=Count(Distinct order_id)>1"}

JG

View solution in original post

2 Replies
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @test14, why don't you try with:

CustomerID = {"=Count(Distinct order_id)>1"}

JG

test14
Contributor II
Contributor II
Author

Thank you, that's perfect.