Display count of something on dashboard

I am working on some dashboards (not EDD dashboards or views) and would like to create some charts that show the dollar value of open orders and also the count of open orders. The dashboard is based off of a BAQ that pulls all order line details. How can I count all unique order numbers (not individual lines) that are open and display on a chart?

You could create a calculated field in your BAQ that determines the number of unique orders, then use it in your dashboard.

One way to get the number of unique orders would be to use the COUNT() aggregate function in a subquery (the subquery would only contain unique orders, no duplicates), then join the subquery to your top query to be able to use the field.

Another way is to use the dense_rank SQL function in a calculated field:

dense_rank() over (partition by OrderHed.Company order by OrderHed.OrderNum ) 
+ dense_rank() over (partition by OrderHed.Company order by OrderHed.OrderNum desc) 
- 1

This should work in your top level query, no subquery required.

Another way is something I call SubSelect

2 Likes