Useful Tableau Calculated Fields

Calendar Type


Name

drag pill to copy

Description

Calculated Field

=T|F
Completed Months

Use this in a filter or another calculated field to get only completed months. If your data set does not have Fiscal Year Month, reference the calculated field for it in this table.

[Fiscal Year Month] < {FIXED : MAX(IIF([Date]=TODAY(),[Fiscal Year Month],NULL))}
=T|F
Completed Weeks

Use as a boolean filter or as part of another calculated field to filter out the dates in the current week.

[Date]<DATETRUNC('week', TODAY())
=#
Day of Year

The day of year, often used to compare the same fiscal date between years. When you don't have a day of year dimension (especially in fiscal calendars) you may need this.

DATEDIFF('day',{FIXED [Fiscal Year] : MIN([Date])},[Date])+1
=#
Fiscal Half

Get the Fiscal Half from Fiscal Quarters.

IIF([Fiscal Quarter]<3,1,2)
=
Fiscal Month (As Date)

See article on how to use this fiscal month as a date so you can filter to the latest fiscal month.

MAKEDATE([FISCAL_YEAR],[FISCAL_MONTH],1)
=#
Fiscal Quarter

Get the Fiscal Quarters from Fiscal Months.

IF [Fiscal Month] < 4 THEN 1
ELSEIF [Fiscal Month] < 7 THEN 2
ELSEIF [Fiscal Month] < 10 THEN 3
ELSE 4
END
=
Fiscal Week (Trick)

See article on how to format and use this fiscal week trick so you can filter to the latest fiscal week.

MAKEDATETIME(MAKEDATE([FISCAL_YEAR],1,1),MAKETIME(0,[FISCAL_WEEK],0))
=
Fiscal Year (As Date)

See article on how to use this fiscal year as a date so you can filter to the latest fiscal year.

MAKEDATE([FISCAL_YEAR],1,1)
=Abc
Fiscal Year Month

Combine Fiscal Year and Fiscal Month dimensions.

STR([Fiscal Year])+RIGHT('0'+STR([Fiscal Month]),2)
=Abc
Fiscal Year Week

Combine Fiscal Year and Fiscal Week dimensions.

STR([Fiscal Year])+RIGHT('0'+STR([Fiscal Week]),2)
=T|F
Last Week

Use as a boolean filter or as part of another calculated field to filter to the dates of last week only.

DATETRUNC('week',[Date]) = DATEADD('week',-1,DATETRUNC('week', TODAY()))
=T|F
Rolling X Fiscal Months (All)

See article for a detailed explanation of this calculated field separated into smaller ones. Use this calculated field as a boolean filter in combination with a parameter to show the last or rolling X number of fiscal months. You can name your parameter above. This is the full version of this calculated field, without splitting it into multiple calculated fields (this is often difficult to read). This is useful for fiscal calendars that do not follow the Gregorian calendar.

MAKEDATE([FISCAL_YEAR] ,[FISCAL_MONTH] ,1>= DATEADD('month',-[Last N] ,{FIXED : MAX(IIF([Date] <= DATE(TODAY()),[Month Static Date] ,NULL))}
AND
MAKEDATE([FISCAL_YEAR] ,[FISCAL_MONTH] ,1{FIXED : MAX(IIF([Date] <= DATE(TODAY()),MAKEDATE([FISCAL_YEAR] ,[FISCAL_MONTH] ,1),NULL))}
=T|F
Rolling X Weeks

See the last or rolling X number of complete weeks using a parameter.

[Date]>=DATEADD('week',-[Last N],DATETRUNC('week', TODAY()))
AND
[Date]<DATETRUNC('week', TODAY())

Your Source for Ready-Made Tableau Calculated Fields!

Supercharge your Tableau experience with CopyCalc's curated collection of pre-built useful calculated fields. Find a meticulously crafted set of commonly used calculated fields that you can easily integrate into your Tableau projects. Use the Date Name and Parameter Name fields above to tailor every calculated field to your own data set and workbook. Search through this table of calculated fields to find the one you need.

Convenience for the Tableau Developer

CopyCalc takes simplicity to the next level. Each calculated field is accompanied by a convenient COPY button, making the integration process a breeze. Simply copy and paste directly into your Tableau workbook. Whether you're a seasoned Tableau pro or just getting started, CopyCalc empowers you to enhance your visualizations without the hassle of manually typing out calculations. This library includes the simple calculated fields that you use but sometimes forget and the complex level of detail calculated fields that could come up in many dashboards.

Calculated Field Formatter

If you find a calculated field that is close to what you need, be sure to pass your final calculated field through the calculated field formatter. You can read more about all of the custom built tools on this website, built by a fellow Tableau developer, on the home page.

Have Another Pain Point?

Learn more about how this website was created, and connect with the developer to build out another tool that you wish existed.