Tableau Desktop Coding Bootcamp | Logical Functions 2

Xpressurdata
27 Nov 202224:32

Summary

TLDRIn this video, Bawar walks through key concepts in Tableau, focusing on logical functions, handling null values, and writing calculations. He explains how to categorize data using IF and CASE statements, manage errors in real-time reports, and handle common issues like division by zero. The video also covers important techniques like using ZN and ISNULL functions to standardize data and avoid errors in Tableau calculations. Bawar encourages viewers to practice the discussed methods and invites them to explore the logic further by writing nested IF statements.

Takeaways

  • ๐Ÿ˜€ The video is a part two session on coding and explores further Tableau calculations and logic building.
  • ๐Ÿ–ฅ๏ธ The presenter demonstrates how to categorize data in Tableau using logical functions, such as categorizing based on profit values.
  • ๐Ÿšจ Exceptional handling is explained, focusing on how to deal with null values in real-time scenarios.
  • ๐Ÿ“ The 'if null' and 'is null' functions are discussed as important tools to handle missing or null values in Tableau.
  • ๐Ÿ“… A case statement is used to convert month numbers into month names, a common requirement in real-time scenarios.
  • ๐Ÿค” The presenter suggests using multiple methods, like nested ifs, to achieve the same result for better understanding.
  • ๐Ÿ“Š Another use case is presented where subcategories are grouped into categories using a case statement.
  • ๐Ÿ”ข The concept of handling division by zero errors in calculations is covered using an if-else condition to avoid null values.
  • ๐Ÿ“‰ The ZN function is introduced as a way to replace null values with zero, a crucial function for standardizing Tableau code.
  • โš™๏ธ The importance of functions like ABS (absolute value) to ensure code stability and handle specific requirements in calculations is discussed.

Q & A

  • What is the primary topic of the video?

    -The video is focused on coding logic development in Tableau, including handling null values, writing logical functions, and using conditional statements like 'IF', 'IS NULL', and 'CASE' for data categorization and calculations.

  • Why is handling null values important in real-time projects?

    -Handling null values is crucial because in real-time data, missing or undefined values can cause issues in calculations and reporting. By addressing null values, you can ensure your logic works smoothly, even when data is incomplete or unexpected.

  • What function does the speaker use to handle null values in Tableau?

    -The speaker uses the 'IFNULL' function to handle null values in Tableau, replacing nulls with a default value, such as 'Not Defined' or zero.

  • What is the purpose of the 'IS NULL' function mentioned in the video?

    -The 'IS NULL' function is used to check whether a given value is null or not. It returns a Boolean result: 'TRUE' if the value is null and 'FALSE' if the value is not null.

  • How does the speaker categorize profit values using conditional logic?

    -The speaker categorizes profit values using a conditional 'IF' statement. For example, if the sum of profit is greater than 40,000, the profit is categorized as 'Good Profit.'

  • What common interview question related to Tableau is discussed in the video?

    -A common interview question discussed in the video is how to write a case statement to categorize months or values in Tableau. This question checks the interviewee's logical ability to work with data in different formats.

  • How can you categorize months in Tableau based on numbers using a CASE statement?

    -To categorize months based on numbers using a CASE statement, you can map the numeric values (e.g., 1 for January, 2 for February) to their respective month names, allowing you to display month names instead of numbers in your Tableau visualizations.

  • What is the purpose of using a 'CASE' statement in the video?

    -The 'CASE' statement is used to categorize data into different groups based on conditions. For instance, the speaker uses it to categorize subcategories into different groups, like 'Group 1', 'Group 2', etc., based on subcategory values.

  • How does Tableau handle division by zero in calculations?

    -In the video, the speaker demonstrates handling division by zero by using a conditional 'IF' statement. If the denominator is zero, Tableau returns zero to avoid errors in calculations.

  • What function does the speaker recommend using to standardize code and handle null values?

    -The speaker recommends using the 'ZN' function in Tableau to standardize code. The 'ZN' function replaces null values with zero, ensuring that calculations can proceed without interruptions due to nulls.

Outlines

00:00

๐Ÿ‘‹ Introduction and Recap of Part 1

The video begins with a greeting from the host, Al Bawar, and an introduction to his YouTube channel, Express Your Data. He briefly recaps the first part of the series, where viewers learned how to build logic and categorize data in Tableau. Al encourages new viewers to watch the first video and subscribe before continuing. He outlines that this video will cover advanced calculations in Tableau, focusing on building on previous lessons, handling data categorization, and writing more complex functions.

05:01

๐Ÿ’ก Categorizing Profit Data in Tableau

In this section, the host introduces a logic-based calculation to categorize profits. He demonstrates how to assign values like 'Good Profit' if the profit is above a certain threshold (e.g., $40,000). He addresses handling null values that result from incomplete logic, introducing the concept of exceptional handling in real-time scenarios. Al explains the use of the `IFNULL` function to replace nulls with meaningful data like 'Not Defined' and compares this with the `ISNULL` function, which checks whether a value is null, returning a Boolean result.

10:02

๐Ÿ—“๏ธ Using Case Statements to Display Month Names

This paragraph focuses on using a `CASE` statement to convert month numbers into readable month names. Al walks through the process of building this logic in Tableau, replacing month numbers with their corresponding names (e.g., 1 = 'Jan'). He highlights the importance of the `CASE` statement for data transformation and mentions how such tasks are often encountered in technical interviews. He wraps up by showing how to handle errors in logic, particularly when there is a mismatch in months, and invites viewers to practice writing similar logic using nested IF statements.

15:03

๐Ÿ“Š Grouping Subcategories Using Case Statements

Al demonstrates how to group subcategories into different zones using a `CASE` statement. He groups subcategories (like Accessories, Appliances, etc.) into multiple groups, explaining how Tableau reads these subcategories and how to assign them into custom groups. This is a common task in real-world scenarios where users need to categorize data into specific zones or headers. The use case showcases how to logically organize and group data in Tableau through a step-by-step example.

20:05

๐Ÿงฎ Handling Division by Zero in Tableau

In this section, Al explains the challenge of handling division by zero errors in Tableau. He demonstrates how to avoid such errors by checking if the denominator is zero before performing any division. If the denominator is zero, Tableau should return 0; otherwise, it calculates the profit by dividing profit by sales. This is a crucial technique for real-time data handling where division by zero can cause errors or misleading results. Al also introduces the `ZN` (Zero Null) function to replace null values with zeros and standardize calculations.

Mindmap

Keywords

๐Ÿ’กTableau

Tableau is a popular data visualization tool used for transforming raw data into understandable graphical representations. In the video, the speaker demonstrates how to use Tableau for logical operations, categorizing data, and generating calculations. The key message revolves around understanding how Tableau processes and computes data step by step, such as how it handles null values and creates visualizations.

๐Ÿ’กIf-Null Function

The 'If-Null' function is a conditional statement in Tableau that allows users to handle null values within their data. It ensures that if a value returns null, a specified alternative value is displayed, preventing errors in the dataset. The speaker shows how to use 'If-Null' to handle unexpected data conditions, like when profits do not meet a predefined threshold.

๐Ÿ’กCase Statement

The 'Case' statement in Tableau is used for conditional logic, allowing users to categorize data based on certain conditions. In the video, the speaker uses a case statement to transform numerical data (like month numbers) into readable names (like January, February) and to categorize subcategories into groups. This concept is essential for flexible data manipulation and efficient data presentation.

๐Ÿ’กSubcategory

In Tableau, a subcategory refers to a smaller division of a larger dataset, often used for grouping or filtering data. The speaker demonstrates how subcategories can be sorted and categorized based on their profits or other metrics. For example, subcategories like 'Accessories' or 'Appliances' are grouped based on custom logic in the video.

๐Ÿ’กProfit

Profit is the difference between the revenue generated from sales and the cost of the goods sold. In the video, the speaker categorizes different subcategories based on their profit levels. This key metric is used to create logical conditions, such as whether a product's profit is considered 'good' or falls below a certain threshold.

๐Ÿ’กNull Values

Null values represent missing or undefined data in a dataset. In the video, the speaker emphasizes the importance of handling null values in Tableau, as they can cause errors or misrepresentations in reports. Methods such as 'If-Null' and 'Is-Null' are introduced to manage these values efficiently by either replacing them with default values or flagging them for further inspection.

๐Ÿ’กLogical Functions

Logical functions in Tableau help define and execute conditions that influence how data is categorized and calculated. The speaker explains how to use logical functions like 'If-Else', 'If-Null', and 'Is-Null' to categorize data based on profits, handle errors, and ensure consistent data reporting. Logical functions are central to automating decisions in data analysis.

๐Ÿ’กIs-Null Function

The 'Is-Null' function is used to check if a value in Tableau is null, returning a boolean (true/false) result. The speaker explains its importance in identifying where data might be missing or incomplete, helping users debug their calculations by distinguishing between valid and null data points.

๐Ÿ’กString Values

String values refer to text data in Tableau. The video demonstrates how to handle string values when categorizing data or writing logical conditions, such as replacing null profit categories with a 'Not Defined' label. This concept is crucial for dealing with non-numeric data in visualizations and reports.

๐Ÿ’กZN Function

The ZN function in Tableau converts null values to zero, ensuring that numerical calculations do not break due to missing data. In the video, the speaker uses the ZN function to handle situations where division by zero might occur, ensuring the final output is standardized and prevents errors in calculations.

Highlights

Introduction to categorizing data and writing calculations in Tableau.

Explanation of how to use logical functions to handle data.

Tutorial on using 'if' statements to categorize data based on profit thresholds.

Introduction to handling null values with the 'ifnull' function.

Explanation of handling exceptional cases in data with null values.

Introduction to 'isnull' for determining whether a value is null in Tableau.

Use of 'case' statements to convert numerical month values into month names.

Demonstration of categorizing data into groups using 'case' statements.

How to handle division by zero in calculations.

Demonstration of using the ZN function to replace null values with zeros in calculations.

Introduction to standardizing code with the ZN function for real-time calculations.

Example of using Tableau's built-in functions to compute quick table calculations.

Explanation of using the absolute (ABS) function in Tableau for handling negative values.

Encouragement to write logic in multiple ways for better understanding and flexibility.

Concluding remarks on the importance of mastering different ways to handle data in Tableau for real-time application.

Transcripts

play00:01

hello everyone this is all bawar and

play00:03

welcome to my YouTube channel express

play00:05

your data so we were you know learning a

play00:08

lot in our coding sessions and this is

play00:10

part two video where we will explore

play00:13

what all we have learned till now and

play00:15

we'll continue so if you are new to my

play00:17

channel don't forget to like share and

play00:19

subscribe and let us get started without

play00:20

wasting much time

play00:22

so if you have friends in my last video

play00:24

video please do

play00:27

watch that video so in that video we

play00:30

have learned how to build logic from the

play00:32

base and we have seen how the data is

play00:35

getting categorized in Tableau and how

play00:38

the execution you know is happening step

play00:41

by step so I'm going to take it a

play00:43

further level up and we are going to

play00:45

write few more calculations and we'll

play00:48

see how Tableau is trying to compute

play00:49

that okay so for that again what I'm

play00:51

doing is I'm taking my sub category and

play00:54

I'm also taking my profit

play00:57

for now because we have got all the

play01:00

values in that and I'm just sorting it

play01:02

now let us open one of the previously

play01:06

built logic because I want to take some

play01:09

part from that and uh okay

play01:14

to

play01:15

okay never mind we'll we'll write it so

play01:18

I'm writing logical

play01:22

functions

play01:26

so it's day two for us okay now what I'm

play01:30

doing is like we have categorized

play01:33

earlier using the same I'm trying to

play01:36

categorize uh it for some time uh for

play01:40

some values on this so if

play01:42

my sum of profit

play01:45

okay is greater than uh let's say assume

play01:48

I'm giving 40 000 okay then I want to

play01:52

categorize as good profit

play01:55

okay and without specifying end part or

play01:59

else part I'm just ending my statement

play02:02

here okay so now like we know it will

play02:05

generate uh or create null values for us

play02:09

right see here till here it is like this

play02:12

now if at all you want to handle this

play02:16

null so we call it as exceptional

play02:19

handing

play02:20

X

play02:22

exceptional

play02:24

handling how do you handle the null

play02:26

values that are coming in your data one

play02:28

of the very important you know uh

play02:32

task in real time because most often

play02:35

after writing your entire logic only for

play02:39

some part of data we get this kind of

play02:41

things okay so we need to think about

play02:44

that also okay so now

play02:47

we have categorized this as good profit

play02:49

but we never expected that you know we

play02:51

will have profits less than or in this

play02:53

range now later on after moving your

play02:55

report into production you got some

play02:57

values which are not falling under your

play02:59

condition then in that case what can we

play03:01

do

play03:02

so now

play03:05

I want to handle this so I'm writing

play03:07

simply

play03:08

if

play03:10

null

play03:11

now observe here I am passing this

play03:14

conditional statement to this if

play03:15

statement so if my value is returning

play03:19

null then specify as not defined

play03:25

and I am simply closing it now what is

play03:28

now what will happen first this inner

play03:31

statement will get executed it will it

play03:33

will print whatever the value is there

play03:36

okay so in cases where it is null then

play03:42

it will print as not not defined click

play03:45

on apply

play03:46

see now clearly if this kind of value is

play03:50

uh we are getting in the calculation

play03:52

then we'll know that okay this is coming

play03:54

from this part and we need to fix this

play03:58

okay so that is your if statement so

play04:00

many times we use this if null in real

play04:03

time as well now this is because string

play04:06

I am deriving a string or defining a

play04:09

string value here

play04:12

now suppose you know instead of this

play04:15

string value I want to uh return 0 in

play04:19

cases of that so that is also one

play04:21

possible case where you might get nulls

play04:24

in number

play04:26

okay so that will see uh and uh other

play04:30

statement with respect to if null we

play04:33

also have another statement which we can

play04:35

use

play04:36

is null so is null will return either

play04:42

this statement is returning a null value

play04:45

or not that's it okay so for this we

play04:48

don't need

play04:50

another condition so just what I'm doing

play04:53

is uh

play04:57

just

play04:59

removing this

play05:01

and removing or just keeping it as is

play05:03

null

play05:05

now e is null of our

play05:08

original if statement that's it

play05:11

now what will happen this is this will

play05:13

become Boolean statement just it will

play05:14

return either true or false so observe

play05:18

now

play05:18

if I see here false this means for these

play05:22

three it is not it is giving us some

play05:24

value so it is not null false means it

play05:27

is not null

play05:30

okay otherwise

play05:32

it is

play05:34

true which means for all other values

play05:36

from papers it is returning

play05:39

null value that is what it is trying to

play05:41

tell us from this statement

play05:43

okay so that is your if null and E is

play05:47

null statement one of the very you know

play05:50

important activity

play05:52

of handling this now what we'll do is

play05:55

we'll write a simple case statement okay

play05:58

so if you remember in our previous video

play06:01

we have uh derived some

play06:05

values related to month same thing I'm

play06:07

trying to do here and uh

play06:12

let us keep this as is and uh

play06:16

I will see if date related is there or

play06:18

not okay so we have date name here I'll

play06:21

just remove this and this

play06:24

and I'll add it here

play06:27

so I have assumed in your database you

play06:31

are getting your months as this one two

play06:34

three four till 12. now you got a

play06:38

requirement that you know you have to

play06:40

display month name

play06:43

and not the number okay while there are

play06:46

multiple ways of doing that I am just

play06:48

doing it using a case statement just so

play06:52

that we can understand how the statement

play06:55

will work so now I'm just calling case

play06:58

of

play07:00

this date and name

play07:02

so when I call that Tableau will try to

play07:05

read all the values that are there in

play07:07

this

play07:08

okay now when

play07:13

then

play07:15

I want to print as

play07:18

like say Jan

play07:20

and I am and date

play07:23

okay so this is valid now okay so

play07:26

likewise I am writing it for all the

play07:29

months here

play07:30

two three four five six

play07:34

okay I'll simply copy this

play07:37

and paste it

play07:39

okay let us uh

play07:46

so I'm gonna write the numbers here to

play07:49

three

play07:51

four

play07:52

five six so one common use case that we

play07:56

might get in real time so you should be

play07:59

aware of this logic as well it's

play08:02

imported for us to understand so

play08:05

likewise now I can write

play08:06

my month name now I can use it wherever

play08:10

I want so first of all I want to

play08:12

use in number format or

play08:17

string format whatever I want I can use

play08:20

it

play08:23

so July

play08:26

so often this question is also asked in

play08:29

interview many times I think in general

play08:30

today I've asked I think in uh

play08:34

Accenture also they have asked I think

play08:37

in Amazon also they asked this kind of

play08:39

you know question in preliminary around

play08:43

so again the question is just to check

play08:45

your logical ability okay so not in

play08:48

terms of Tableau but technologically you

play08:50

should be in a state that

play08:53

you can derive this

play08:57

okay I'm clicking on apply and I can

play08:59

take this statement and I can drop it

play09:01

now you see it is returning me

play09:04

this value okay so now you got null here

play09:08

see here

play09:09

between some error is there at your 12th

play09:12

number now you will go back and observe

play09:15

what you have done so you will see that

play09:17

you have written 11 12 times so this

play09:19

kind of issues are also possible when

play09:21

you are writing you need to First verify

play09:24

if it is correct or not now you got all

play09:27

the values

play09:28

if any value you are missing at the

play09:31

then

play09:32

that will display null

play09:35

yeah

play09:36

Okay so

play09:39

if anything other than this value that

play09:41

you are coming then you can write simply

play09:43

again if null on this

play09:49

sorry

play09:52

just to standardize the code

play09:56

if null

play09:58

of this entire statement and what you

play10:02

want to tell not categorized

play10:05

I'm writing it like this

play10:09

and close it

play10:14

sorry

play10:18

like this

play10:27

okay so this way also I can write it

play10:29

click on apply

play10:32

now again another use case uh we will

play10:35

see so same thing and now you can try it

play10:39

using if statement you can try to build

play10:42

this using nestative and see if you are

play10:44

able to you know achieve this again you

play10:48

know it becomes interesting when you try

play10:49

to write the same requirement in

play10:51

multiple ways that is when we will be

play10:54

able to understand the logical you know

play10:57

part of it and we will be able to tune

play10:59

ourselves so that we can write logic in

play11:02

multiple ways so again the question for

play11:05

you whoever is watching uh try to write

play11:08

the same

play11:10

thing in using IF

play11:13

or I will say nested if

play11:15

so that you understand better try it

play11:17

that way if you are not getting let me

play11:20

know I'll post it if you are getting it

play11:23

do paste it in the comment section so

play11:25

that you know it helps others who are

play11:27

watching

play11:29

now likewise you know one common

play11:31

requirement we get in you know real time

play11:34

is you know categorizing the values into

play11:38

some different zones so assume here I've

play11:41

got like 17 subcategory items now user

play11:45

wanted to categorize into some groups

play11:48

okay so one method is you know creating

play11:50

a groups but I don't want to follow

play11:52

group approach just because you know uh

play11:55

you know

play11:56

from learning perspective I want to use

play11:58

some calculations so that I can derive

play12:01

the value

play12:02

so for that what I'm you writing is just

play12:04

creating grouping uh sub category here

play12:10

now here I want to group my

play12:13

category into four parts or two to three

play12:16

parts let us say as an example so again

play12:19

many times I think I have asked in

play12:21

interview but many failed to you know

play12:24

write this

play12:25

so today I'm trying to show you that we

play12:28

are

play12:29

categorizing subcategory

play12:32

into

play12:34

four parts

play12:36

okay so how can we do now I'm writing

play12:41

we can do it using multiple methods I am

play12:44

using case statement because we are

play12:45

learning about case so case of sub

play12:48

category and I'm calling when it is uh

play12:51

accessories so one important thing that

play12:54

we need to understand about case

play12:55

statement is whenever you are calling

play12:58

this subcategory

play12:59

Tableau will try to read all the values

play13:01

that are there in that subcategory item

play13:04

and it follows and it is case sensitive

play13:07

okay

play13:08

so I am just trying to pass whatever is

play13:11

there in this when accessories then I

play13:14

want to call it as like say group one

play13:17

and when it is uh

play13:20

appliances

play13:23

so I'm just taking uh

play13:26

alternate values here

play13:28

at

play13:30

then I'm calling it as group

play13:34

to

play13:35

when

play13:38

binders

play13:41

then it is group two

play13:47

when it is uh

play13:51

chairs

play13:53

then I'm calling it as

play13:56

group one so randomly I'm I'm passing it

play14:00

okay so you can try any other method

play14:03

that you feel again the purpose is to

play14:06

show you how we can write okay and uh

play14:09

when so anything okay so when it is one

play14:14

more we need when it is a papers

play14:20

and it is paper then it is

play14:23

group

play14:25

3

play14:27

when it is uh

play14:30

phone

play14:33

then it is group three

play14:38

any other than this

play14:41

any other value that is coming apart

play14:43

from this then it is group

play14:46

4

play14:48

me and it simply

play14:51

okay now if I click on apply

play14:55

and if I take it

play14:57

onto column shelf see how my groups are

play15:01

getting categorized so if I don't want

play15:03

this I can simply take my remove this

play15:05

and if I take subcategory into label

play15:09

now it is clearly showing how many items

play15:12

or how many subcategory items we have in

play15:16

groups so if I aggregate this

play15:21

see

play15:22

so maybe account distinct we have

play15:26

Group 1 has two subcategory items group

play15:30

two has two group three has one and

play15:31

group four has got

play15:33

12 subcategory items this way also we

play15:36

can

play15:37

you know use this to create headers

play15:41

so you know many times we create headers

play15:43

on top of something so this kind of a

play15:46

requirement also you can get it in real

play15:48

time

play15:49

okay now what I'm doing is uh just to

play15:52

show you one more use case here let us

play15:55

play with some a number here

play15:58

and I'm trying to

play16:03

okay so let us take sub category here

play16:11

and I'm taking profit here

play16:17

okay so we got profit okay now what I'm

play16:20

doing is I'm taking

play16:22

uh I'm writing a simple calculation here

play16:25

and I'm trying to write

play16:27

profit by

play16:28

sales I am doing

play16:31

okay so not profit so sum of

play16:33

profit

play16:37

by

play16:39

Marcel

play16:41

so some I'm just trying to divide it so

play16:44

that I can see the value and I'm writing

play16:47

here as uh

play16:49

logical 4 here

play16:56

and I'm just writing it or dragging it

play16:58

here

play16:59

I'll make it discrete

play17:02

now it is giving us some value right

play17:04

again the whole point here is just to

play17:07

show you one use case here now instead

play17:09

of this

play17:11

I am trying to write 0 here

play17:15

division by zero

play17:19

so now we are getting null value

play17:21

so now observe here even though our

play17:24

calculation is valid here okay it is

play17:28

giving us zero now I want to handle this

play17:32

okay one of the very very important you

play17:35

know requirement in real time how can we

play17:38

handle this if

play17:41

um

play17:50

okay so I want to just uh

play17:54

call it as uh

play17:58

okay so replace some of

play18:01

sales

play18:05

with zero

play18:13

let us see what is the okay so first let

play18:17

us comment this

play18:20

still we are getting replace is called

play18:23

with the float do you mean string stick

play18:26

oh

play18:27

okay so see now we are getting string

play18:30

error here so

play18:32

if I try to convert it into string

play18:43

okay

play18:49

uh I'm trying to just hard code my sum

play18:52

of sales to zero

play18:54

directly zero so that I can

play18:58

fix it

play19:10

[Music]

play19:25

okay so what I'm trying to do is I'm

play19:27

simply trying to zero all my sum of

play19:30

sales so see here how I'm doing if my

play19:33

sum of sales

play19:36

is not equal to 0 then I want to print

play19:40

zero okay else also 0 and it okay I'm

play19:45

just trying to test this

play19:47

and you see I'm getting 0 here

play19:51

now I'm just trying to divide this

play19:55

with our sum of profit

play20:02

divided by this

play20:04

okay now

play20:07

now what is happening see here

play20:08

everything we are getting null now I

play20:11

want to handle my denominator that when

play20:14

we are getting this 0 or when our

play20:18

denominator is basically zero I want to

play20:20

display 0 that's it okay otherwise it

play20:23

should display profit that is the

play20:24

requirement here how can we do

play20:27

is

play20:30

uh

play20:32

I'm taking this statement here

play20:36

so whatever in the is there in the

play20:38

denominator I'm taking that

play20:42

is equal to

play20:44

zero

play20:46

then

play20:49

print as zero okay

play20:52

else

play20:56

it would be sum of

play21:00

profit farming

play21:03

that's it

play21:06

end it

play21:08

okay so now something okay so we will

play21:11

comment our these two parts and we'll

play21:14

try to test it

play21:15

yeah so now what will happen it will

play21:18

test my denominator part so don't get

play21:20

confused this is my denominator part if

play21:23

this is somehow 0

play21:25

then directly print the calculation as 0

play21:28

because anything divided by 0 is

play21:31

actually not calculatable so directly I

play21:33

am creating that as 0 otherwise print my

play21:37

sum of profit that is how I am trying to

play21:39

do here click on apply now see here

play21:42

we're doing it like this

play21:45

okay so we can play it play with our

play21:48

logics

play21:50

like the way we want we just need to

play21:52

understand how we can build that

play21:55

so now if I try to write this here

play22:00

and I'm just showing you another use

play22:04

case here

play22:06

so this is valid now if I click on this

play22:08

I'm getting uh

play22:15

null value now I want to handle this

play22:18

whenever we are getting null I want to

play22:20

replace it with 0. simply you can use

play22:23

another function called as 0 or sorry ZN

play22:26

function and you can simply cover this

play22:29

up

play22:31

now what will happen in all the cases

play22:33

wherever you are getting null Tableau

play22:36

will directly automatically replace it

play22:38

with 0. click on apply

play22:41

now you are getting zero one of the very

play22:45

important function which is used to

play22:48

standardize your code so

play22:53

one example

play22:55

if I take on this and if I try to

play22:58

compute

play23:00

quick table calculation like say percent

play23:01

of total I am trying to do

play23:03

now when I double click this it will

play23:05

edit and if I copy

play23:08

and paste it here

play23:10

uh

play23:12

see the code it is trying to do uh okay

play23:15

now what I'm trying to do is uh

play23:19

maybe I want to percentage difference I

play23:22

am trying to do

play23:23

yeah and control this thing

play23:28

now see here the way calculation is

play23:32

being generated by Tableau it is also

play23:35

using ZN function to standardize the

play23:37

code

play23:38

see here apps function it is trying to

play23:40

use now what it is doing

play23:43

denominator cannot be

play23:46

you know divided by negative number so

play23:49

what it is doing it is using absolute

play23:52

function to standardize the code

play23:56

in denominator we don't need negative

play23:58

value so that's why whatever is coming

play24:00

in the denominator we are just removing

play24:02

the negative number from that or

play24:04

negative symbol from that and making it

play24:06

absolute value

play24:08

that way we can standardize our code so

play24:10

this is one very good example for us to

play24:13

understand that how Tableau will write

play24:15

the code so the same format is extracted

play24:18

from mu in real time as well

play24:20

okay so that's it from what I said in

play24:23

this video I hope this video has helped

play24:25

you if it does don't forget to like

play24:26

share and subscribe see you in the next

play24:28

video have a good day and bye

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
Tableau tutorialData visualizationCoding logicNull handlingReal-time analysisProfit categorizationIf statementsCase statementsData calculationsBeginner Tableau