
1. Re: How to convert string to number using tableau calulation
John Sobczak Jun 27, 2016 4:09 AM (in response to Kannan Athmanathan)Have you tried the below?
IF sum([Sales]) >= 1000 and sum([Sales]) < 10000 THEN
"Overall Sales  " + LEFT(str(sum([Sales])),1) + "," + mid(str(sum([Sales])),2,3)elseif
sum([Sales]) >= 10000 and sum([Sales]) < 100000 THEN
"Overall Sales  " + LEFT(str(sum([Sales])),2) + "," + mid(str(sum([Sales])),3,3)elseif
sum([Sales]) >= 100000 and sum([Sales]) < 1000000 THEN
"Overall Sales  " + LEFT(str(sum([Sales])),3) + "," + mid(str(sum([Sales])),4,3)elseif
sum([Sales]) >= 1000000 and sum([Sales]) < 10000000 THEN
"Overall Sales  " + LEFT(str(sum([Sales])),1) + "," + mid(str(sum([Sales])),2,3) + "," + mid(str(sum([Sales])),5,3)END

2. Re: How to convert string to number using tableau calulation
Michael Hesser Jun 27, 2016 4:30 AM (in response to Kannan Athmanathan)Hi Kannan
I think you might find your answer here:
Number Formatting with Comma Separator inside Parameter Calculation
Matt Lutton wrote this beauty and he took hammered it out the goodold fashioned way: analyzed each sum and applied the correct formatting. Hopefully your data won't exceed 100 Trillion.
His code, which I'm sure you can tweak, is:

PARAMETER CALC
CASE[Choose Measure]
when "Sales" then
IF len(str([Sum Sales]))<3 THEN
"$" + str([Sum Sales])
ELSEIF len(str([Sum Sales]))<=6 THEN
"$" + LEFT(str([Sum Sales]), Len(str([Sum Sales]))3)
+ "," + RIGHT(str([Sum Sales]), 3)
ELSEIF len(str([Sum Sales]))<=9 THEN
"$" + LEFT(str([Sum Sales]), Len(str([Sum Sales]))6)
+ "," + MID(RIGHT(str([Sum Sales]), 6), 1, 3) + ","
+ RIGHT(str([Sum Sales]), 3)
ELSEIF len(str([Sum Sales]))<=12 THEN
"$" + LEFT(str([Sum Sales]), Len(str([Sum Sales]))9)
+ "," + MID(RIGHT(str([Sum Sales]), 9), 1, 3)
+ "," + MID(RIGHT(str([Sum Sales]), 6), 1, 3) + ","
+ RIGHT(str([Sum Sales]), 3)
ELSEIF len(str([Sum Sales]))<=15 THEN
"$" + LEFT(str([Sum Sales]), Len(str([Sum Sales]))12)
+ "," + MID(RIGHT(str([Sum Sales]), 12), 1, 3)
+ "," + MID(RIGHT(str([Sum Sales]), 9), 1, 3)
+ "," + MID(RIGHT(str([Sum Sales]), 6), 1, 3) + ","
+ RIGHT(str([Sum Sales]), 3)
ELSE
"More than 100 Trillon Dollars"
END
when "Ratio" then str(round(sum(Profit)/([Sum Sales])*100, 2))+"%"
end

Good luck!

3. Re: How to convert string to number using tableau calulation
Dmitry Chirkov Jun 27, 2016 10:22 AM (in response to Kannan Athmanathan)1 of 1 people found this helpfulYou just need to format the label itself.
 Put measure you want on the label
 Format it the way you need (separators, numbers after comma etc)
 Modify label's text  your 'Overall ..." text goes there.