7 Replies Latest reply on Nov 1, 2018 12:12 PM by Connor Freeman

# Noob Calculated Field Syntax Question (2018.2.3)

Apologies for posting as I'm certain this has been asked many times before.

I'm struggling with the transition from Excel to Tableau syntax, I think.

I'm trying to get the percentage difference of a sum of unique measure values based on a string, or attribute, within a dimension.

As an example –

I’m pulling [event label] and [total events] from Google Analytics.

I then split [event label] to get a set of more unique events. "Wall-shown" and "checkout-complete", in this case. Each event has corresponding total events in the measure values.

I want to divide "checkout-complete" total events by "wall-shown" total events to get a conversion rate.

eventname: "wall-shown"||action: "stop"||category: "block"||type: "paywall…

eventname: "checkout-complete"||action: "completed"||category: "payment"||type: "paywall"||offers: {"te…

In plain English, it would look like this –

IF [event label] contains “wall-shown”, THEN SUM [total events] divided by IF [event label] contains “checkout-complete”, THEN SUM [total events].

I get any of several varieties of errors when i attempt the calculated field.

Happy to hear other criticisms. My first dashboard so I acknowledge I have far to go.

Thanks

Deepak

• ###### 2. Re: Noob Calculated Field Syntax Question (2018.2.3)

Ah, yes.

Thank you.

• ###### 3. Re: Noob Calculated Field Syntax Question (2018.2.3)

Updated with extract.

Many thanks.

• ###### 4. Re: Noob Calculated Field Syntax Question (2018.2.3)

Hi,

I cannot see your dashboard due to missing connexion but we can make it without it.

You can create your measures in three time:

1.SUM (if [event label]  = 'wall-shown' then [total events] end )

2. sum (IF [event label] = 'checkout-complete'  THEN [total events])

3. divide both measure

Cédric

1 of 1 people found this helpful
• ###### 5. Re: Noob Calculated Field Syntax Question (2018.2.3)

Thank you so very much.

I have three valid calculations now. So I’m getting closer. But I’m not getting a result I can drag into the marks table or the sheet.

Unrelated, but related, I added an attachment with an extract so contents can be viewed.

In any event, I’m certainly a bit closer and I appreciate your help.

The single, open-quote in the calculation means ‘contains’ then?

• ###### 6. Re: Noob Calculated Field Syntax Question (2018.2.3)

Hi,

If the syntaxe is correct, but there is no result, you may have to check wether the value in the IF statement is correctly spelled.

Put in line your dimension and check the correct spelling and put it in the QUOTE.

Welcome to Tableau by the way :-)

Cédric

1 of 1 people found this helpful
• ###### 7. Re: Noob Calculated Field Syntax Question (2018.2.3)

Quite glad to be here and very much appreciated.

Thank you!