Getting Data In

To get data from different source types

xvxt006
Contributor

Hi,

I am trying to calculate conversion rate using number of orders/visits. Number of visits from one sourcetype and visits are from different source type. So i have used join command. But i am not getting any output

sourcetype=XXXXX | stats count(OrderTotal) as Orders | join append[search sourcetype=YYYYY | stats dc(SessionID) as visits] | eval CVR =(Orders/Visits)*100 | table CVR

When i take out table CVR i can see that the 2 stats output values separately. But i want to use those and calculate the CVR and just output that value alone. Any help is much appreciated.

Tags (1)
0 Karma
1 Solution

lguinn2
Legend

Try this

sourcetype=XXXXX  or sourcetype=YYYYYY
| stats count(OrderTotal) as Orders dc(SessionID) as Visits
| eval CVR =(Orders/Visits)*100

OR this, which is less efficient usually

sourcetype=XXXXXX
| stats count(OrderTotal) as Orders
| appendcols [ search sourcetype=YYYYY
    | stats dc(SessionID) as Visits ]
| eval CVR =(Orders/Visits)*100

Also, note that you used "visits" in one spot, and "Visits" in another. Field names are case-sensitive!

HTH

View solution in original post

lguinn2
Legend

Try this

sourcetype=XXXXX  or sourcetype=YYYYYY
| stats count(OrderTotal) as Orders dc(SessionID) as Visits
| eval CVR =(Orders/Visits)*100

OR this, which is less efficient usually

sourcetype=XXXXXX
| stats count(OrderTotal) as Orders
| appendcols [ search sourcetype=YYYYY
    | stats dc(SessionID) as Visits ]
| eval CVR =(Orders/Visits)*100

Also, note that you used "visits" in one spot, and "Visits" in another. Field names are case-sensitive!

HTH

xvxt006
Contributor

I tried your first solution initially and may be i might have missed the case sensitivity. Thank you HTH it is working now.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...