7 Replies Latest reply on Mar 15, 2018 9:27 AM by Silvia Assuncao

# help If Formula - maybe aggregation

Hi, I'm have some trouble creating this calculation.

In my dimensions I have this company name which have 2 different company codes and I need the formula to consider that when doing the calculation.

when I have the company codes displayed in the table the calculated field is okay, but when I take off the compay code the number changes. I think it's some aggregation problem.

could someone help me out with this?

• ###### 1. Re: help If Formula - maybe aggregation

I have changed your formula little bit, I hope this works.

Please see attached workbook .

sum(IF ([Company_Code])<>"F105"  THEN ([Aop Lc]-[Estimate Lc])/({ include : avg([USD Rate AOP])})

else

([Aop Lc]-[Estimate Lc])

END) 1 of 1 people found this helpful
• ###### 2. Re: help If Formula - maybe aggregation

thanks, it worked. thanks

• ###### 3. Re: help If Formula - maybe aggregation

Hi Arvingarg,

maybe you can help me again.

So I have selected other Company Codes (or countries) and when I have only this field as a dimension in my table the number are total correct.

but then I duplicated this sheet and included 2 new dimensions for category and the values for this formula started to be wrong.

then I duplicated the sheet again to have the values only by category and now the values are even more wrong. what change is necessary for the number to be according to the first sheet?

I'm including the application with the new sheets here.

I would really appreciate your help here. • ###### 4. Re: help If Formula - maybe aggregation

Hey

I looked into this. If you notice Average USD Rate AOP is not matching as well. If variation formula is also using this column as well.

I think it makes sense. Because when you change granularity average changes as well.

I hope below average calculation makes sense.

6+2 /2 = 4     4+6+2/3 = 4    4+4 = 8

6+2+4+6+2/5 = 4

• ###### 5. Re: help If Formula - maybe aggregation

So, how can I solve this granularity problem and have the indicated field to have the same total value as I have in when value is by Countries only?

• ###### 6. Re: help If Formula - maybe aggregation

Sorry, It is very tough to say without knowing more details about this workbook and data.

I will look into this when time permits.

• ###### 7. Re: help If Formula - maybe aggregation

Hi!

thanks for the reply.

I think I found the solution.

I did two things. as I need for the values to consider the fixed rate according to the company name, I created a calculated field to calculate the currency rate average:

I named this field TESTEE_USD_RATE

then I changed the other calculated field, including this field in the formula. now it totally worked.

thanks
{"ft_lang_label":"__label__en","ft_lang_prob":0.9105245,"math_prob":0.77847517,"size":2660,"snap":"2019-13-2019-22","text_gpt3_token_len":746,"char_repetition_ratio":0.11746988,"word_repetition_ratio":0.10799136,"special_character_ratio":0.27406016,"punctuation_ratio":0.12177122,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9814478,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-03-24T17:08:14Z\",\"WARC-Record-ID\":\"<urn:uuid:fcb16482-6fd3-44fc-a531-3b55d949152a>\",\"Content-Length\":\"119986\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3af33adb-ada5-4a49-85ee-cdb88de0c43b>\",\"WARC-Concurrent-To\":\"<urn:uuid:61d36c0c-3e3d-49b1-a063-ac0c308e1c8f>\",\"WARC-IP-Address\":\"204.93.79.205\",\"WARC-Target-URI\":\"https://community.tableau.com/thread/264578\",\"WARC-Payload-Digest\":\"sha1:HBE2LWJHZE4LQWWHFZXRFMYJGUN3KJOH\",\"WARC-Block-Digest\":\"sha1:PCAVGIUXYFHP22MLTULNSMQHOUWUBXIJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-13/CC-MAIN-2019-13_segments_1552912203464.67_warc_CC-MAIN-20190324165854-20190324191854-00524.warc.gz\"}"}