Forum Discussion
Distinct Count not working
But How I can solve this problem, The Fields That I have is:
Order No,
Branch Name
Order Type (Pickup, Di-In, Delivery)
Meal: (Breakfast, Dinner, and Lunch)
Total Order Price
Total Quantity
I want to calculate the Average Order Size (Total Order Price/No Of Orders)
In each branch for (Order Type and Meal),
I'm now doing the query (R Language) as the following:
Branch_Order_Size<-select(Order_Product_Sub,Order No,orders.quantity,orders.final_price,branches.name,Meal,Order_Type) %>%
group_by(Order No,branches.name,Meal,Order_Type) %>%
summarise (Total_Sales= sum(orders.products.final_price),Total_Quantity=sum(orders.products.quantity),Total_Branch_Orders=length(unique(Order No))) %>%
ungroup() %>%
as.data.frame()
The Right No Of Orders should be: 651895
If I calculated it as a measure It gives the right Number, If column it gives me: 1,689,975
What change shall I do in the query to give me the right total number of orders?
Have you got solution for your requirenment? If you got the solution, Please let me know.