Tableau - Calculated Field
Published:
This post covers Calculated Field.
Examples
- Currency Conversions
- Rounding Price
Calculated Field
- Import data set and create chart for sales of different countries
- Create a new calculated field - Profit Ratio (Total Profit/Total Sales)
- Select Analysis from main top tool bar-> Create Calculated Field
- Type Name of field and write SUM([Profit])/SUM([Sales]) as value
- Drag Country to Row; Segment to columns; Profit Ratio to Text Card
- Which country has highest Profit Ratio for Consumer segment: Oman, 0.483
- Create a new calculated field - Discount Ratio
- IIF([Sales] !=0, [Discount]/[Sales], 0)
- IIF(test, then, else, [unknown])
- IF test THEN value END
- IF test THEN value ELSE else END
- IF test1 THEN value1 ELSEIF test2 THEN value2 ELSE else END
- Drag Country to Rows; Segment to columns; Discount to Text
- Which country has the highest discount ratio under consumer:
- US
- IIF([Sales] !=0, [Discount]/[Sales], 0)