Solved

How to pass 'FORMULA' in Event Segmentation API

  • 19 October 2022
  • 1 reply
  • 142 views

Hello Amplitude Members, Hope you are doing well. 
I am fairly new to Amplitude and we are using this in our application to track multiple events and property. 

I am using ‘Event Segmentation API’ to fetch information regarding an event by passing the event-property and group by too. 
One last thing is to pass ‘FORMULA’ in my api. I can see, that there’s a param named formula, and I tried passing it like 

  • propcount(A); 
  • PROPCOUNT(A)
  • “PROPCOUNT(A)”
  • PROPCOUNT( e param’s value )

but none of them gave the right answer, can I please know the exact way to pass this formula in API ?

Thanks and Regards 

Manish Sharma

icon

Best answer by Saish Redkar 20 October 2022, 19:31

View original

1 reply

Userlevel 7
Badge +10

Hi @Manish Sharma 

I normally use Python requests to query Amplitude Dashboard APIs.

Assuming you are grouping the event by an event property to use the PROPCOUNT(A) custom formula in your case, here is the dictionary structure I would use to create your query parameters

{'m': 'formula', 'i': '30', 'start': '20220101', 'end': '20220831', 'formula': 'PROPCOUNT(A)', 'e': '{"event_type": "Sample Action Triggered", "group_by": [{"type": "event", "value": "event_property_name"}]}'}

I was able to replicate my custom formula chart using PROPCOUNT and other parameters using the above

Hope this helps.

Reply