Skip to main content
Solved

How to use event property as a parameter in user formula?


I want to show performance of some computations inside my app. Duration of the computations depends on input size, so I want to compute avg(COMPUTATION_DURATION / INPUT_SIZE), but both values are params of the same event.

Best answer by Yuanyuan Zhang

Hi @pkolesnikov

Besides Saish’s amazing suggestions, if your intention is indeed to make calculation of the properties that belong to one event and make it a new property, our Computations feature is perfect for it. Please note that this feature is only included in our Recommend Package.

In case you just want to see one average value during each day/week/month interval, instead of getting the ratio for each event, you could use a custom formula like this: https://analytics.amplitude.com/demo/chart/new/7dpczn0

Hope this helps!

View original
Did this topic help you find an answer to your question?

3 replies

  • Author
  • New Member
  • 2 replies
  • July 26, 2022

Of course I could just send that information in the event, but I don’t want to increase event size to avoid unnecessary network usage + I want to compute that for legacy data also


Saish Redkar
Expert
Forum|alt.badge.img+10

Hey @pkolesnikov 

I don’t think there is an easy/direct way of isolating individual property values and doing such arithmetic inside the custom formula view. However, it supports arithmetic on values returned on property aggregation eg. PROPSUM,etc. So something like SUM ( all COMPUTATION_DURATION values ) / SUM( all INPUT_SIZE values ) recorded in a day/week/month is possible

I believe you want to calculate this ratio for every event and then average it over the time interval ? If yes, then the derived properties feature could help you do this i.e. create a new property on the relevant event which calculates this COMPUTATION_DURATION / INPUT_SIZE ratio. And then use the measured as Average of Property Value metric in the event seg chart or even the PROPAVG(A) custom formula.

Note that Derived properties is only available to enterprise customers and customers who have purchased the Govern add-on.

Let me know if I have interpreted your use case correctly. Hope this helps.

 


Yuanyuan Zhang
Team Member
Forum|alt.badge.img+5

Hi @pkolesnikov

Besides Saish’s amazing suggestions, if your intention is indeed to make calculation of the properties that belong to one event and make it a new property, our Computations feature is perfect for it. Please note that this feature is only included in our Recommend Package.

In case you just want to see one average value during each day/week/month interval, instead of getting the ratio for each event, you could use a custom formula like this: https://analytics.amplitude.com/demo/chart/new/7dpczn0

Hope this helps!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings