Reputation: 103
I have a calculated field:
People_Needed / People_Required
That sums People_Needed and divides that by the sum of People_Required.
I have another column called "Month". I have a parameter that has all the months in the dataset. I want the calculated field to change to calculate just on the month that is selected. So if "May" is selected, then calculate People_Needed / People_Required on just the month of May.
How can this be done in the Tableau calculated field?
Upvotes: 0
Views: 375
Reputation: 26238
Not that difficult. You can change the CF to
IF [month] = [month parameter] then [People_needed] END /
If [month] = [month parameter] then [people_required] end
Still I would suggest you should use aggregation inside the calculation as
sum(IF [month] = [month parameter] then [People_needed] END ) /
sum(If [month] = [month parameter] then [people_required] end )
Upvotes: 1