Nested fixed functions

Options
Sean_Tully
Sean_Tully Contributor

Hi All -

We are using fixed functions to calculate the average LTV per year for certain audiences. In the end, we want to be able to sum up the averages into a total 4-year LTV for the audience, which requires another fixed function. However, we're hitting errors when we wrap our calc in the new fixed function to sum up each of the averaged values. We've rewritten the calc so as not to reference any other beast modes, in case that was the issue, but still getting an error. Has anyone done anything similar successfully in a beast mode? Is there an issue with nesting fixed functions this way? Thanks!

Tagged:

Best Answer

  • ArborRose
    ArborRose Coach
    Answer ✓
    Options

    Or…avoiding nesting fixed functions:

    sum(
    sum(Total LTV) fixed (by Year, Dimension 2, Dimension 3)
    ) /
    sum(
    sum(Total Orders) fixed (by Year, Dimension 2, Dimension 3)
    )

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

Answers

  • MichelleH
    Options

    @Sean_Tully Could you please share the current fixed function you're using?

  • Sean_Tully
    Sean_Tully Contributor
    Options

    It's something like this:

    sum(SUM(Total LTV) fixed (by Year, Dimension 2, Dimension 3))
    /
    sum(SUM(Total Orders) fixed (by Year, Dimension 2, Dimension 3))

  • ArborRose
    Options

    What is the error you are receiving? Without the error message it's a bit hard to pinpoint the issue.

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • Sean_Tully
    Sean_Tully Contributor
    Options

    Yeah, sorry, it was just the generic 'This calculation contained a syntax error' message in the beast mode, but we've had a few eyes on it and rewrote it piece by piece and we don't see any problems with the syntax, other than maybe nesting the fixed functions within each other throws the error. In the end it looks like this:

    sum(sum(

    sum(SUM(Total LTV) fixed (by YearDimension 2Dimension 3))
    /
    sum(SUM(Total Orders) fixed (by YearDimension 2Dimension 3))

    ) fixed (by Dimension 2Dimension 3))

  • ArborRose
    Options

    Perhaps you could try something like this, wrapping the entire calculation in another fixed function:

    sum(
    sum(
    sum(Total LTV) fixed (by Year, Dimension 2, Dimension 3)
    ) /
    sum(
    sum(Total Orders) fixed (by Year, Dimension 2, Dimension 3)
    )
    ) fixed (by Dimension 2, Dimension 3)

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • ArborRose
    ArborRose Coach
    Answer ✓
    Options

    Or…avoiding nesting fixed functions:

    sum(
    sum(Total LTV) fixed (by Year, Dimension 2, Dimension 3)
    ) /
    sum(
    sum(Total Orders) fixed (by Year, Dimension 2, Dimension 3)
    )

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • Sean_Tully
    Sean_Tully Contributor
    Options

    I accepted @ArborRose's answer. We found a way to what we needed without using the fixed function, though not in the same way - we used case statements for each year and added those up rather than the nested fixed function.