6 Replies Latest reply on Sep 1, 2016 4:41 AM by Sandeep Kotha

# Calculation field Problem

Hi All,

I have question on calculated field.I have created a field called "label 1" as { FIXED :MAX([FiscalWeek])}.

I used it in the title using the insert option as shown in the below snapshot.Current week is going on "Week -10" but i got it as "Week -9".But When I place the "Fiscalweek" field onto the rows shelf, it is showing "Week 10" level(check the below third snapshot).But the label1 shows the week 9 which is wrong as per the formulae.

Not sure what went wrong.I have refreshed the tableau data as well.

Could someone help me on this?

Thank you.

Best Wishes,

Sandeep

• ###### 1. Re: Calculation field Problem

Hi, Sandeep

would be better if you attached the workbook. but check to see if,

- wk 10 has data

- if it's in the same year (wk 10 could be the previous year maybe)

Hope this helps.

Mia

• ###### 2. Re: Calculation field Problem

Hi Mia,

Thanks for the reply. I have attached the workbook along with sample data.I don't think it is year problem but I am unable to identify the error.

Please let me know what went wrong.

Best Wishes,

Sandeep

• ###### 3. Re: Calculation field Problem

I know why it's showing these results, but I don't know the way to correct it (yet).

label1 is interpeted as text/string. The max of string doesn't account for the numbers the same way as a measure. You can test this using excel . Put al the weeks in Excel and change the datatype to string. Then use sort.  A "9" is more then "1" but also "10" and "11".

1 of 1 people found this helpful
• ###### 4. Re: Calculation field Problem

Hi,

Yes, You are correct. label1 is in string format.I did it in excel and i got the below order.

 Week - 9 Week - 8 Week - 7 Week - 6 Week - 5 Week - 3 Week - 10 Week - 1

Oh my God! How to resolve this problem now:(

Thank you.

Best Wishes,

Sandeep

• ###### 5. Re: Calculation field Problem

I see two possible solutions:

1. Use a date field
Create a calculated field where the fiscal week is a date. Then let Tableau 'automaticly' convert it to week. I don't know if there is a 'date-relation' between the actual date en the fiscal date. That's up to you.
You can use a string. Just add an extra zero. "Week - 1" becomes "Week - 01".
1 of 1 people found this helpful
• ###### 6. Re: Calculation field Problem

Hi MATTHIJS BLENKERS,

WOW! The second option worked perfectly for me.

Thank you so much for your help on this.