KNOWLEDGE BASE

How To Display Numbers in Japanese Yen Price Format With Using "億", "万" and "円"


Published: 09 Apr 2021
Last Modified Date: 12 Apr 2021

Question

If I set a custom format for a number dimension as ####億####万####円 to display as Japanese Yen prices according to the Excel style number code, unnecessary "億" is added to the top of numbers if the number is less than 100,000,000 yen (1億円). How can I set correct Japanese Yen price format with using "億", "万" and "円"?

Environment

  • Tableau Desktop

Answer

Create a calculated field including the following formula. In this formula, Price field is converted to string first, then "億", "万" or "円" is inserted into the sting values based on the  number of digits.
IF LEN(STR([Price]))=9 THEN LEFT(STR([Price]),1)+"億"+MID(STR([Price]),2,4)+"万"+RIGHT(STR([Price]),4)+"円"
ELSEIF LEN(STR([Price]))=8 THEN LEFT(STR([Price]),4)+"万"+RIGHT(STR([Price]),4)+"円" 
ELSEIF LEN(STR([Price]))=7 THEN LEFT(STR([Price]),3)+"万"+RIGHT(STR([Price]),4)+"円" END

 
Did this article resolve the issue?