Alfonso
Alfonso

Reputation: 113

Tableau add filter inside calculated field

In Tableau i have a calculated field like this below:

COUNTD( 
IF(
MONTH([Dataevent]) == 4
) THEN [Id] end)
/
COUNTD( 
IF(
YEAR([Dataevento]) == 2018
) THEN [Id] end)

i would like to add a filter to automatically select from the sheet the month and the year without hardcoding them, like this:

COUNTD( 
IF(
MONTH([Dataevent]) == filter
) THEN [Id] end)
/
COUNTD( 
IF(
YEAR([Dataevento]) == filter
) THEN [Id] end)

how should i do?

Upvotes: 1

Views: 1132

Answers (1)

Nicolaesse
Nicolaesse

Reputation: 2724

You can do it with parameters.

You have to

  1. create a parameter
  2. use it inside your calculated field
  3. Add a filter control to the parameter

You can find a good tutorial following this link.

Upvotes: 2

Related Questions