Forum Discussion
Distinct Count not working
This depends on your table structure. Calculated column will calculate on each row level, measure will aggregate on current slicing context. For your current context in your visual, if it contains multiple entries about "current slicing field-Order No", it will be calculated multiple times when using calculated column.
See my sample below:
As we have date dimension slicing, we have multiple entries for "User-Order". If you use calculated column, it will duplicate the result.
For better understanding, please refer to this blog: Calculated Columns and Measures in DAX
Regards,
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?
- Kavya1237 years agoHelper III
Have you got solution for your requirenment? If you got the solution, Please let me know.
- makcim3926 years agoAdvocate I
MAAbdullah47 hi, did you get to a solution? I'd also like to know