Reputation: 53
I have a simple COUNTIF task in Excel that is proving rather difficult to replicate in Tableau...
This is the data:
ID Metric Scope DynamicCalc
1 A1 TRUE X
1 B1 FALSE X
2 B1 TRUE X
2 A1 FALSE X
2 C1 FALSE X
The column 'DynamicCalc' should have the following values when Metric=A1
is selected: TRUE,TRUE,FALSE,FALSE,FALSE
but if say B1
is selected it would be FALSE,FALSE,TRUE,TRUE,TRUE
... so basically I want to assign a value of TRUE to the DynamicColumn if there is at least one TRUE in the Scope column to all rows for that ID.
Upvotes: 3
Views: 17793
Reputation: 26218
I know this is late, but as SO community (bot) has made it active again, I propose a slightly different approach. The selection should be through parameter.
After making parameter on Metric
field, create a calculated field say Dynamic calc
like this
{FIXED ID : MAX({FIXED ID, [Metric]: MAX(If [Metric] = [Metric Parameter] THEN [Scope] END)})}
Add this field and your desired view is complete. See GIF below
Upvotes: 0
Reputation: 7189
The LOD
Expression can be used to retrieve your desired result
try using a calculated field
like below :
{FIXED [ID],[Metric]:MAX(if [Scope]='TRUE' then 'True' else 'False' end)}
When the Selection is B1 :
Upvotes: 0