Hi all, I’m faced with the following problem:
I have a table that has the following columns of importance:
orderDate, orderID, userID, userName, orderValue
My goal is to find out the bucket in which a user belongs, i.e., a user placed between 5-10 orders in in the current month, 10-15, 15-20, etc. I have done the following calculations:
numberOfOrders: count(id)
I then used this calculated field to create another calculated field that defines the buckets.
orderBuckets:
However, when I add this calculated field as a dimension, it doesn’t work since this is a custom aggregated field. I was able to get this down as a value field in a table, however I need to add this to a visual such as a pivot table or a bar graph, as seen in the image below (done on google sheets)
I did try using the countOver function in the following method: countOver(id, [userId])
However this didn’t work as well. I haven’t tried the countIf function yet but I can do that and report back to you!
@rohit_SB - I believe since you are looking to do it for a given user in current month then you need to first create a calculated column name Order Month from Order Date column and then utilize that in LAC expression. It would be something like
This worked perfectly @Giridhar.Prabhu ! May I get the reasoning why a LAC-W function works well over here? Why do we use this function and what does this exactly do that allows me to recognize a calculated field as a dimension? I’d like to know as this might be extremely useful for future use cases.