Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count distincvt if 3 conditions are met in set analysis

I would like to know how many unique "Service_Order_Number" exist if the "expense_type' = labor, the "...type_description" = "travel_time", and the the amount of travel time ("invoiced_qty...") is equal to zero. Basically, unique service calls that have no travel time invoiced against them.  I get no returns? =COUNT({$}DISTINCT Service_Order_Number)

1 Solution

Accepted Solutions
pover
Luminary Alumni
Luminary Alumni

Sorry I meant expense_type -= {"travel*"}

View solution in original post

10 Replies
Anonymous
Not applicable
Author

Sorry, full expression - =COUNT({$}DISTINCT Service_Order_Number)

pover
Luminary Alumni
Luminary Alumni

Try this...

=count({$<exprense_type={'labor'},type_description={'travel_time'}, Service_Order_Number={"=sum(invoiced_qty)=0"}>} Distinct Service_Order_Number)

Karl

Anonymous
Not applicable
Author

Cannot seem to post the whole expression unless I type it in manually...

=COUNT({$<Expense_Type={"Labor"}, Service_Expense_Type_Description = {"Travel Time"}, "Invoiced_Quantity" = {"0"}>}DISTINCT Service_Order_Number)

Anonymous
Not applicable
Author

That is very helpful Karl, thank you.  It brings to light another issue that I would like to accomodate for - The exporession works great when a Service Order HAS a labor line with description travel, but in reviewing the results, I think what I really want is a countof unique service orders where there are NO service expense type descriptions "travel time"

pover
Luminary Alumni
Luminary Alumni

Just put a '-' in front of the equal sign to exclude that value.

=count({$<exprense_type={'labor'},type_description-={'travel_time'}, Service_Order_Number={"=sum(invoiced_qty)=0"}>} Distinct Service_Order_Number)

Karl

Anonymous
Not applicable
Author

Getting closer!  If the Service Order has NO expense type description "travel.." count unique Service orders.

pover
Luminary Alumni
Luminary Alumni

Instead of 'travel_time' put "travel*"

Karl

pover
Luminary Alumni
Luminary Alumni

Sorry I meant expense_type -= {"travel*"}

Anonymous
Not applicable
Author

Karl, thank you so much for your help.  I am so close.  It is counting now only when both expense type = travel = 0  and all other expense type = 0.  I only wat to count unique when only expense type description -= travel.  I would send you the qvw, but it is huge.