Direkt zum Hauptbereich

How do ASCII and CHAR work?



ASCII
ASCII stay for American Standard Code for Information Interchange. ASCII is a character encoding to display text on computers and electronic devices. All ASCII codes you can find here.

ASCII function returns the ASCII value of the leftmost character of a given string. Usually these functions are using when you work with HTML. Unfortunately I do not work with HTML and I cannot say more about the way of using of this function.

Anyway let us take a look at the example in tableau and let's understand what happened by using of this function.

I dropped "Category" from the example of Superstore to the row and created a calculation field


If we take a look at the table: ASCII - Code, we can see that for the upper "F" we have value 70, for "O" - 79 and for "T" - 84. So why do we have 148,470 for the "Furniture"; 476,054 for the "Office Supplies" and 155,148 for the "Technology"?

Because tableau aggregates all "F" in the whole table "Superstore". There are 2,121 rows, which begin with "F", so tableau gives as the sum of them: 2,121*70=148,470. We have also 6,028 with "O" (79*6028 = 476,054) and 1,847 rows with "T" (1,847*84 = 155,148)

In order to get ASCII - Code as a not aggregated result, we have to use function MIN() or MAX() or AVG()




CHAR
You can also convert the ASCII Code into Spells, by using the CHAR function. Look at this example:

I have a data set with this numbers

Code
68
105
108
121
97
110
97

With the function “CHAR” I could convert this numbers into spells.
I would appreciate, if you could give me some examples in which cases do you use this function.

Take care! 😉








Kommentare

Beliebte Posts aus diesem Blog

Tableau Table Calculation Function: WINDOW - Functions

The functions which begin with „WINDOW_...“ are also common used in Tableau. Remember! The “WINDOW_” function stays for the offset in data set, so-called WINDOW. It can look like this: 1) You can see the “WINDOW” clearly because of separation line between rows: 2) You limit the “Window” by giving the information about the first and the last row number. In this case, you give Tableau the information about the data offset. Let's have a look at the example with WINDOW_SUM I created a sample with data from Superstore. I would like to have a total sum of Sales in every row. In order to do this I created a calculation field: WINDOW_SUM(SUM([Sales]), FIRST(), LAST()) With this formula I said to Tableau: “Hey Tableau, calculate the total sum of sales from the first till the last row in the data set” And this is the result: Tableau wrote the result (total sum of Sales) in every row. As another option you can cumulate the result in each row and...

Tableau Number Function: ABS

I have been working with Tableau since 2014, but I have still a feeling that my knowledge about this software not good enough. When I rebuild dashboards from tableau.public I am fascinating how some people can create amazing formulas and thus it makes the calculation of data sets easier. Sometimes I got stuck by creating of graphs and I do some calculations with data in Excel before I visualize them. Otherwise, you can find the definition of every function by creating of calculation field. But, honestly, are this definitions always clearly enough? For me not and I am done by doing long calculations with Excel. 😠 I like my work and I want to have more fun and not do such long calculation with Excel! I took up a challenge and decided to go through every function in tableau in order to understand how they work.  I would like to begin with ABS function.  ABS function is very easy one, as it used to get an absolute value of a number from a negative one. As an examp...

Level of Detail Expressions (LoD) in Tableau: FIXED

The last keyword of LoD I am talking to is FIXED. Remember! By the function INCLUDE we included some numbers into the calculation even though we don't visualize this number. By the function EXCLUDE we exclude some numbers from the calculation even though we visualize them. With the function FIXED we “freeze” some numbers in our calculation, i.e. we can run calculation of all art, but the “fixed” dimension remains unchanged. This is the structure of FIXED function: With this function we can e.g calculate a frequency of customer's orders, calculate unique customers from month to month as the cumulative value etc.. Let us have a look to an example, where we analyze sub-categories: I created a simple cross table with the data from Superstore: I would like to see this numbers in a hint text, if I analyze sub-categories. I created a stucked bar chart, which shows sales in each region. I also highlighted sub-categories with different color, as I would ...