Expand my Community achievements bar.

Webinar: Adobe Customer Journey Analytics Product Innovations: A Quarterly Overview. Come learn for the Adobe Analytics Product team who will be covering AJO reporting, Graph-based Stitching, guided analysis for CJA, and more!
SOLVED

Calculated metric function: CUMULATIVE - cannot use functions to set the "number" parameter

Avatar

Level 2

I am trying to create a calculated metric, which cumulate a static number based on month of year.

 

For example each day in January should add 100, but each day in February should only add 50.

 

I am using the IF function to control which month is in question.

 

For 'value_if_true' I have added the CUMULATIVE function. In the "number" parameter for the CUMULATIVE function I want to limit only the row for January. Unfortunately, if I add December to the time period it will cumulate 100 for each day of December as well.

 

If I try to make the "number" parameter dynamic, for example based on a function, for example "ROW COUNT()", then the CUMULATIVE function breaks down completely and do not return any values.

 

I have tried other functions in place of the "number" parameter and they all seem be broken.

 

Is this by design or have I misunderstood how to use the "number" parameter?

 

cgullestrup_0-1643808541773.png

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Here's something that I've learned about Calculated Metrics: they calculate based on the row-wise data. So your Calculated Metric is basically doing this: calculate the value for every row and return the Cumulative per row. But Cumulative should be the "outer" function, i.e. you want: calculate the Cumulative value from the value of each row.

Try this:

CUMULATIVE

  • number: 0
  • metric: IF
    • logical_test: (Month of Year = January) Visits
    • value_if_true: 100
    • value_if_false: IF
      • logical_test: (Month of Year = February) Visits
      • value_if_true: 50
      • value_if_false: IF
        • logical_test: (Month of Year = March) Visits
        • ...

So now for each row, AA should calculate your value from the month, then CUMULATIVE sums them all up. In the end, all of your rows will report that same CUMULATIVE result.

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Here's something that I've learned about Calculated Metrics: they calculate based on the row-wise data. So your Calculated Metric is basically doing this: calculate the value for every row and return the Cumulative per row. But Cumulative should be the "outer" function, i.e. you want: calculate the Cumulative value from the value of each row.

Try this:

CUMULATIVE

  • number: 0
  • metric: IF
    • logical_test: (Month of Year = January) Visits
    • value_if_true: 100
    • value_if_false: IF
      • logical_test: (Month of Year = February) Visits
      • value_if_true: 50
      • value_if_false: IF
        • logical_test: (Month of Year = March) Visits
        • ...

So now for each row, AA should calculate your value from the month, then CUMULATIVE sums them all up. In the end, all of your rows will report that same CUMULATIVE result.

Avatar

Community Advisor

Just curious what are you trying to correlate Month data too?

 

Are you trying to measure a weighted sort of avg for months of year on a set of page(s)?

Avatar

Level 2

We are going to add sales target numbers throughout the year to compare with actual sales, but these differ from month to month, so there is a need for this per month calculation

Avatar

Community Advisor

ok makes sense then!! thanks for clarifying!