Direkt zum Hauptbereich

Posts

Es werden Posts vom Mai, 2017 angezeigt.

Tableau Logical Functions: IF, IIF, IFNULL

Have you ever had the situations when you would like to add some conditions as a text or as a number in one separate column? And you got stuck on it. The solution is “IF”, “IIF”, and “IFNULL” functions. IF With the function IF you can add three or more conditions to your calculation: IF test1 THEN value1 ELSEIF test2 THEN value2 ELSE else END EXAMPLE IF SUM([Profit])>5000 then "Profit" ELSEIF SUM([Profit])<4999 and SUM([Profit])>2000 then "Breakeven" ELSE "Loss" END Note! If you create this formula, use exact the aggregation in the text field. In the example above the aggregation is SUM([Profit]), thus I used this aggregation in the formula and NOT just [Profit]. IIF If you want to run a calculation with TWO conditions, e.g. : If I have “XY”, then give me “Z”, otherwise give me “AB” (two conditions!), then use the function IIF. EXAMPLE Assume, we have this data set: I would like to calculate the Conversi...

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 Logical Function: CASE

Today I would like to discuss about my favorite function in Tableau: CASE I like this function because the using is many-sided and you can create both dimensions and numbers. Example 1: Rename (Dimension) If you would like to rename some data set, not using the option “Alias”, then you can use the CASE Here Tableau looks at data items in “Category”, compare it and if it finds any match, it renames them into the labels I entered. Example 2: 5 Total sum (Number) If you would like to calculate the rate for each items in the Category, then you can also use the Case function. Here Tableau looks at data items in “Category”, compare it and if it finds any match, it gives % Total sum ([Anzahl der Datensätze]/9994). If you have any questions left, let me know…..

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 ...

Level of Detail Expressions (LoD) in Tableau: EXCLUDE

One of other keyword of LoD is the function EXCLUDE. If you have already read my article about INCLUDE than you will easier understand the function EXCLUDE. Remember! By the function INCLUDE we included some numbers into the calculation even though we didn't visualize this number. By the function EXCLUDE we exclude some numbers from the calculation even through we visualize them. However, let's us go step by step... With the function EXCLUDE you can find answers to such questions like: - What is the total slaes, as well as the total sales by region. Its means: [(1) We need to exclude Region from our calculation of the monthly Total Sales (2) And then include Region when calculating the regional Sales breakdowns.] Here is the structure of this function: With other words: with this formula we said to Tableau: "Hey, Tableau, please ignore (EXCLUDE) "Region" if you calculate sales (SUM[Sales])" Let's have a look to the practice:...

Level of Detail Expressions (LoD) in Tableau: INCLUDE

I think LoD is the most popular calculation method if you are using tableau. Thus, you can find a lot of good blogs, whitepappers etc., to this topic. There are three keywords in LoD: INCLUDE, EXCLUDE and FIXED. However, why LoD is so popular? Why everybody discussed about this keywords? Where is the magic? As you know, Tableau shows you data if you put this data to the row or to the column. However, what if you would like to count into some numbers, but you don't want to vizualize them?... The answer is LoD :) Let's have a look to the first magic function: INCLUDE With this function you can find an answer to such questions like: - Which region has the highest average of order size? - Which country in the sales database has sales reps who close the “biggest deals,” on average? Here is the structure of this function: If we modify the formula to : AVG({INCLUDE [Order ID]:SUM([Sales])}) we would find an answer to the question: Which region has the highes...

Tableau's Attribute Function ATTR()

There are a lot of blog posts about this function. However, for me the best one was written by Tim Costello. You can find the post here. ATTR comes from Attribute. An attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such. If you take a look for Tableau Online Help , then you can find this definition: Tableau computes Attribute using the following formula: IF MIN([dimension]) = MAX([dimension]) THEN MIN([dimension]) ELSE “*” END I would say this is the main logic of ATTR function. With this formula you can understand how the ATTR function works. In simple words ATTR returns a value if it is unique, else it returns * Check out this links for mor examples: Drawing with numbers Powerful &Misunderstood: Tableau's ATTR Function Using ATTR Function It would be gerate if you share your examples of using of ATTR's function. Thank you!

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...

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...