Only count Max value in sales orders

I’m looking to create a calculated field that only counts the highest value product of an order.

I have isolated the max value product in each Order with rank([max({sales])DESC]) - but can’t figure out how to then count only the max value Product in a Pivot Table. See example and outcome.

Business-side example

Order 1
Product A - $100
Product B - $75
Product C - $50

Order 2
Product B - $75
Product C - $50

Order 3
Product A - $100
Product C - $50

Outcome I’m looking for in a Pivot Table

Count of Products where Product is Max value

Product A - 2
Product B - 1
Product C - 0

Hi @simplyconvert

Could you please try the following calculated field to count the number of orders in which a product has the highest sales value.

Example: (Replace the fields from your dataset)

Count Orders by Max Product - ifelse(Dollar = maxOver(Dollar, [{Order Id}], PRE_AGG), 1, 0)

1 Like

Thank you so much for a solution, Xclipse.

1 Like