Distinctcountover not taking calculative field as partition by field

Hey Everyone,
I am using Distinctcountover function and I need to partition by a calculated field.


Here Label group is a calculated field dimension.

This is the error is shown on the chart visual when using this distinctcountover field
The error is : Your calculated field expression contains invalid syntax

If I change the label group in the partition by with the field used to derive it, the error gets resolved.

But I want to use the calc field expression in the partioning.

Is that possible?

Hello! Yes in some cases you can use other functions inside the Partition field list, but in most cases it is better to create that as its own calculated field first and then reference it in your Level Aware computation. I agree it would be nice to be able to put it all in one big calc though. I will bring this to the product team to see if we can improve that experience.

Hey @Jesse ,
Thanks for the reply.
I think you got me wrong.
In my case I am not able to reference the calculated field, which is Label Group inside the partition by list.
The calculation does not show error, but when it is used in the visual the the visual shows- calculated field contains invalid syntax.

Top3Grouplevel% field in the visual is the calculated field I have shared snapshot of previously.

Thanks

Ah, ok. I know this isn’t an ideal solution but can you try adding your Label Group calculation into your Data Set instead of adding it in the analysis? Does that work?

Hey @Jesse,
Thanks, adding the calculation at data set level did work.
But it would be great to have the feature of adding calculated field from the analysis inside of the partition by of distinctcountover like how it is possible in sumover and count over.

Agreed, it should be possible in the analysis too. Will bring this to the product team.

I’ve spent two hours trying to figure this out while doing a cohort analysis. Came out that I need to define cohorts at the dataset level, like suggested here. Not very convenient, but works.