Capitalize() function converts the first character of each word in a text string to uppercase and converts all other characters to lowercase.
Syntax:
Capitalize(text)
Return data type: string
Arguments
Argument
Description
text
The string to evaluate.
Example: Chart expressions
Example
Result
Capitalize( 'star trek' )
Returns Star Trek
Capitalize( 'AA bb cC Dd' )
Returns Aa Bb Cc Dd
Example - Capitalize fundamentals
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset which is loaded into a data table called Example.
One field in the data table called TextToCapitalize.
Load script
Example:
Load * inline [
TextToCapitalize
50 Cent
a-ha
BIGBANG
girl in red
];
Results
Load the data and open a sheet. Create a new table and add this field as a dimension:
TextToCapitalize
Create the following calculated dimension:
=Capitalize(TextToCapitalize), to calculate which characters to capitalize.
Results table
TextToCapitalize
Capitalize(TextToCapitalize)
50 Cent
50 Cent
a-ha
A-Ha
BIGBANG
Bigbang
girl in red
Girl In Red
There is no change to the first row of data as the first set of characters starts with a number and the second is already capitalized.
In the second row, the first and third characters are capitalized.
In the third row, only the first letter is capitalized, and all subsequent letters are set to lowercase.
In the fourth row, the first letter of each word is capitalized.
The following code shows how to use the function in a load script.
Load
String,
Capitalize(String)
Inline
[String
rHode iSland
washingTon d.C.
new york];
Results table
String
Capitalize(String)
rHode iSland
Rhode Island
washingTon d.C.
Washington D.C.
new york
New York
Example - Capitalize scenario
Overview
A dataset of customer names are entered using various formats, such as all lowercase, all uppercase, or mixed case. The Capitalize function is used to clean the data so that the customer's first and last name are properly capitalized when displayed in the dashboard.
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset which is loaded into a data table called Example.
One field in the data table called CustomerName.
Load script
Example:
Load * inline [
CustomerName
john smith
JANE DOE
miCHAel Brown
];
Results
Load the data and open a sheet. Create a new table and add this field as a dimension:
CustomerName
Create the following calculated dimension:
=Capitalize(CustomerName), to capitalize the customer names.
Results table
CustomerName
Capitalize(CustomerName)
JANE DOE
Jane Doe
john smith
John Smith
miCHAel Brown
Michael Brown
Compare the output of the Capitalize function to the original CustomerName string values that loaded in the script. You can see how the function successfully converted the names to use proper case. Displaying customer names with standardized capitalization improves the appearance, consistency, and readability of the dashboard.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. The information does not usually directly identify you, but it makes the site work as you expect it to and can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
Privacy & Cookie Notice
Manage Consent Preferences
Strictly Necessary Cookies
Always Active
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work.
Functional Cookies
These cookies enable the website to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies, then some or all of these services may not function properly. These cookies do not typically store personal information enabling us to identify you, but are based on uniquely identifying your browser and internet device.
Performance Cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site and make it easier to navigate. For example, they help us to know which pages are the most and least popular and see how visitors move around the site. When analyzing this data it is typically done on an aggregated (anonymous) basis.
Advertising Cookies
These cookies may be set through our site by our advertising partners to build a profile of your interests and show you relevant advertisements on other sites. They do not typically store personal information enabling us to identify you, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less relevant advertising.