Solved

How to add the calculation of any two events to the ROLLWIN() function?


Userlevel 1
Badge

Hello dear Support service!
I have previously submitted a question to the ticket https://community.amplitude.com/building-and-sharing-your-analysis-58/how-can-several-events-with-certain-time-intervals-be-displayed- in-one-chart-1030?postid=3547#post3547 for which you quickly found a solution, for which I am very grateful!
Since that ticket is already marked as RESOLVED, I decided to create a new ticket.

I need to add another chart where I will use events A and B in it (these can be any events)
First I need to do some simple math between events:
Event A multiplied by 100 and divided by event B - A*100/B.

Next, I need to substitute the result of these calculations in the ROLLWIN() form in order to display the result of the formula on the chart. But I can't do that because the specific syntax of the ROLLWIN() formula doesn't allow me, I can only use:
ROLLWIN(UNIQUES, A, 7)
ROLLWIN(TOTALS, A, 7)

So the question is, how do I substitute the result of my calculations (A*100/B) into the ROLLWIN() formula?

I would highly appreciate your help!

icon

Best answer by Saish Redkar 17 May 2022, 16:20

View original

3 replies

Userlevel 5
Badge +9

@sergii Hope all is well!

To my understanding, you want to include a calculation (i.e A*100/B) into the ROLLWIN custom formula.

As Denis mentioned in the other thread, here, Amplitude does not currently support having a calculation within the RollWIN custom formula. This would be a feature request which Denis has graciously offered to do on your behalf.

Userlevel 1
Badge

Hi @eddie.gaona , thanks, already found a solution in the ticket https://community.amplitude.com/building-and-sharing-your-analysis-58/how-can-several-events-with-certain-time-intervals-be-displayed-in -one-chart-1030. You can close this ticket

Userlevel 7
Badge +10

Summarizing this one for other users who might stumble upon this topic -

  • Amplitude doesn’t support nested calculations for the ROLLWIN custom formula yet. The syntax for that is strictly ROLLWIN(metric, event, # of five-minute intervals/hours/days/weeks/months).
  • ROLLWIN works only a particular event at a time instead of arithmetic on multiple events. An alternate way for this would be to use the ROLLWIN output and then apply mathematical operations on the aggregate if the use case exists.

ROLLWIN formula result aggregation on the two events can be applied in the following way -

          ROLLWIN(UNIQUES, A, 7)*100/ROLLWIN(UNIQUES, B, 7);

Reply