Tableau CheatSheet


Last Value by Partition


{
fixed [Company]:
max(

    if [Year]={fixed [Company]:max([Year])}

    then [Category] end

)
}

Latest Values

Latest Month Sales

IF DATEDIFF('month',DATETRUNC('month',[Order Date]),{MAX(DATETRUNC('month',[Order Date]))})=0
THEN [Sales]
END

Previous Month Sales

IF DATEDIFF('month',DATETRUNC('month',[Order Date]),{MAX(DATETRUNC('month',[Order Date]))})=1
THEN [Sales]
END

Prior Month Sales

IF DATEDIFF('month',DATETRUNC('month',[Order Date]),{MAX(DATETRUNC('month',[Order Date]))})=2
THEN [Sales]
END

Average of % Difference


WINDOW_AVG([Week to Week growth ])

Days in Month


DATEDIFF('day', DATETRUNC('month',[Date]), DATEADD('month',1,DATETRUNC('month',[Date]))) -1

Symbols

▲ △ ▼ ▽ ▶ ▷ ◀ ◁● ◐ ◑ ◒ ◓ ◔ ◕■ □ ☀ ☁ ☂ ☃ ☐ ☑ ☒ ✓ ✔ ✖ ✘ ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ⇐ ⇑ ⇒ ⇓ ⇔ ⇕ ⇖ ⇗ ⇘ ⇙
⇦ ⇧ ⇨ ⇩

Number to String

IF ABS(SUM([Summa (EUR)])) >= 1000000000 THEN
//round for billions
STR(ROUND(SUM([Summa (EUR)] / 1000000000), 2)) + " B"
ELSEIF ABS(SUM([Summa (EUR)])) >= 1000000 THEN
//round for millions
STR(ROUND(SUM([Summa (EUR)] / 1000000), 2)) + " M"
ELSEIF ABS(SUM([Summa (EUR)])) >= 1000 THEN
//round for thousands
STR(ROUND(SUm([Summa (EUR)] / 1000), 2)) + " K"
ELSE
STR(ROUND(SUM([Summa (EUR)]),0))
END