Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Assignment

Q1.Display ‘sales’ field values upto the nearest integer or to a specified two decimal places.

Ans.

To make the “sales” field value upto the nearest integer or to a specified two decimal places.
We can Simply just right click the ‘Sales’ field and choose format and change it to custom as
shown in the given Screenshot
Q2.How to create a column Alias?

Ans.

To create a column alias we just need to right the particular column we need make alias
for, then go to alias and change the aliases default name to whatever we want them to be. For
eg. in the screenshot below I changed the name for supplies to other.
Q3.How to get current date and time?
Ans. We can get current date and time by using a calculated function named Now which
returns value of current date and time in a calculated field. I have used this calculated
field in the title as in the Screenshot below:-

Q4.How to check if a data is a of type date?


Ans. We can simply look at the symbols in front of data types.

Here these shapes represent different data types and for date type it’s the Calendar one.
Or we can go to data source to and click on the above symbols to find out the data type.
Q5.Give an expression to add 4 months to the date 014-03-12?

Ans. Expression:- DATEADD(“month”,4, #2014-03-12#)


Output:- 2014-07-12 12:00:00 AM

Q6.Use a CASE function to display the following information: When the value “Paris” is
found, it uses “PS.” When “United Kingdom” is found, it uses “UK.” All other values
receive the value “World.”

Ans.
Expression:- Case [Region] WHEN “Paris” THEN “PS” WHEN “United Kingdom”
THEN “UK” ELSE “World” END

Q7. Recreate the query in question 6 using nested IF Else.

Ans.
Expression:- IF [Region]== “Paris” THEN “PS” ELSEIF [Region]== “United Kingdom”
THEN “UK” ELSE “World”

Q8.What does REPLACE function do in Tableau?

Ans. REPLACE(string, substring, replacement)


This String functions will replace find any occurrence of the substring in the string and
replace those characters with the replacement string. If the substring is not found in the
string, then there is no change.
Example:
REPLACE(“calculation”, “ion”, “ed”) = “calculated”

Q9. Which function returns the number of items in a group?

Ans. Count(Expression)
Expression:- Count(Cities)
Output:- Will return no. of cities in cities group.

Q10. Which filter is used to get the top 10 values from a view?
Ans. Top option in Tableau filter is used to limit the result set from a filter. As for the
question you want only the top 10 values. You can apply this filter using the inbuilt options
for limiting the records in many ways or by creating a formula.

Q11. What is the ASCII value of “United Kingdom”?


Ans. Using ASCII function will return the ASCII value of first character. So for “United
Kingdom”, ASCII(“United Kingdom”) = 85
Q12. Find the position of ‘T’ in string “SOFTWARE”?

Ans. We can find the position by using FIND(“String”, “Sub-String”, [Index]) function
Expression:-
FIND(“SOFTWARE”, “T”)
Output:- 4

Q13. Use string functions to converts all characters in the ‘MISSISSIPPI’ string into lower
case letters.
Ans. We can lower all the letters by using LOWER(string)
Expression:- LOWER(“MISSISSIPPI”)
OutPut:- mississippi

Q14. Remove any spaces starting the string “ tableau”.


Ans. To remove only the starting spaces we use LTRIM(string)
Expression:- LTRIM(“ tableau”)
Output:- tableau
Q15. Find the middle 3 characters at position 4 from the string “Indiaisagreatcountry”?
Ans. To Find middle 3 characters we use MID(string, start, [length])
Expression:- MID(“Indiaisagreatcountry”, 4, 3)
Output:- iai
Q16. Replace characters “ing” with “ed” in the string “organizing”.
Ans. We can simply use REPLACE(string, substring, replacement) function
Expression:- REPLACE(“organizing”, “ing”, “ed”)

Q17. Find out the sales in the cities, which contain the letter “o”?
Ans. For this, We can simply make a calculated field using CONTAINS(field, string)
function
Expression:-CONTAINS([cities], “o”)
Q18. Find out the total sales along with the difference in the date of sales in months from
12st Feb 2009.
Ans.
Q19. Return ‘Good’ if the Profit is greater than 0, and Quantity is greater than 25000,
otherwise, return Bad.
Ans. We will make a calculated field as “GoodBad” with the
Expression:- IF [Profit]>0 AND [Quantity]>25000 THEN "Good" ELSE "Bad" END

Output:
Q20. Return ‘Good’ if the Profit is greater than 0, or Quantity is greater than 25000,
otherwise, return Bad.
Ans. Same as Above.

Q21. Use Tableau IIF function to returns true if Profit is greater then zero. Otherwise, Loss
will return.

Ans. For this we will make a new calculated field Named “True Loss”

Expression:-

Output:-
Q22. Check if there is nulls in quantity field.
Ans. To check for null values in quantity field we just have to make a calculated field
using ISNULL function with
Expression:-IF ISNULL([Quantity]) THEN “Null”
Q23. Replace null values with zero value if there is nulls in quantity field.
Q24. Replace null values with 10 if there is nulls in quantity field.
Q25. Recode Categories Furniture , Office Supplies and Technology as Category 1,
Category 2 and Category 3 respectively.
Q26. Find the subcategories that are selling above average and the one below average.
Q27. Find the difference in months from order date to ship date.
Q28. Add 2 months in orderdate.
Q29. Name the order days in the March 2011

You might also like