Lag function used in dataset causing causing problem in analysis calculation

Hey All,
I was trying lag function on a categorical field.
Would someone help me know, if that works.

If it does, I am facing a problem around the same.:arrow_down:
I have created 2 fields at dataset level and stored in spice.
Field1 : CampStatus :

Field2 : LagCampStatus :
This one uses an aggregation function.

The lag function works absolutely fine and stores the data in spice well.

But further, in the analysis when I am trying to use the 2 fields together…It’s showing this mismatched aggregation. error.

How is the data field creation method impacting calculation in the analysis?
Could someone please answer?

Thanks,
Ummehaani

Looks like you might not be able to do aggregation in an ifelse statement. Can you try to add the ifelse statement in your dataset. In the analysis, add the lag function? Don’t add the lag function in the dataset. Instead, add it in the analysis after you publish your dataset.

1 Like

You need to aggregate the CampStatus in your if else function.

You can do this with a firstValue function.

firstValue({CampStatus},[{CampStatus} ASC],[{CampStatus}])

Let me know if that helps

1 Like