How to return the value on which the condition is met for the first time

0 votes

I only want to return the left most value i.e., the value when the condition is met for the first time.enter image description here

In the images it shows 95% 96% etc etc I only care for the column 5 where the condition of 95 is met. The percentages are calculated this way.

ROUND( RUNNING_SUM( SUM( [days_to_close_cnt] ) )/ SUM([newo_dt_cnt]),2 )

Using and the "Days to Close" gives me the column information.

The Line graph looks like this:

enter image description here

if [% Completed] >= .98  and  [% Completed] < 1 then INT( 98 )
elseif [% Completed] = 1  then INT(  1 )
elseif  [% Completed] >= .95  and [% Completed] < .98 then INT( 95 )
elseif  [% Completed] < .95 and [% Completed] >= .0 then INT(  0 )
end

I am using the above calculation to color in this case. enter image description here

Aug 10, 2018 in Tableau by AwesomeSauce
• 860 points
1,191 views

1 answer to this question.

0 votes

It looks like you are trying to tell when a running total crosses a threshold. In Tableau, doing that requires table calculations which operate on the aggregated values that have been returned from the data source.

I put together an example to illustrate how to approach this issue. Here's a static snapshot of my example:static snapshot

You can define a boolean calculated field to tell whether the running total meets the threshold on a particular day and then use window_min() to calculate the first day that meets the threshold.

Table calculations are powerful, but are also the feature in Tableau that takes the most time to get your head around. So break things down and tackle them in small bites instead of trying to write complex table calculations all at once. Be aware that specifying the partitioning and addressing fields (i.e., compute using) for a table calculation is as important as writing the formula.

Also you can rewrite your Calculated field as below:

if [% Completed] < .95 then 0
elseif [% Completed] < .98 then 95
elseif [% Completed] < 1 then 98
else 1
end

I hope this helps!
answered Aug 14, 2018 by Naruto
• 710 points

Related Questions In Tableau

0 votes
0 answers

How to export the IdP (Identity provider) XML Metadata from Keycloak which is imported to Tableau?

Keycloak version 1.6.1, Goal: Keycloak should act ...READ MORE

Mar 29, 2018 in Tableau by ffdfd
• 5,550 points
2,335 views
0 votes
1 answer

How to replace the count(field) which is missing in data with zero in tableau?

Use calculated field to create a dummy ...READ MORE

answered Dec 21, 2019 in Tableau by sindhu
2,030 views
0 votes
1 answer

How to use LOD to count distinct number of records based on some condition?

From the desired output it seems that ...READ MORE

answered Apr 9, 2018 in Tableau by xyz
• 1,560 points
17,371 views
0 votes
1 answer

How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
9,931 views
0 votes
1 answer

How interactive graphs are generated in Tableau?

Lot of back end code is shared ...READ MORE

answered Apr 14, 2018 in Tableau by xyz
• 1,560 points
857 views
0 votes
1 answer

How to determine average per event by year?

Hi Roshan, Create a new calculated field (use ...READ MORE

answered Sep 25, 2018 in Tableau by Machdata
• 340 points
876 views
0 votes
1 answer

How to combine rows with same information in Tableau

@Ghost, Tableau has a function RANK_UNIQUE which you ...READ MORE

answered May 25, 2018 in Tableau by Atul
• 10,240 points
7,681 views
0 votes
1 answer

How to refresh the extracted data source automatically in Tableau Desktop?

Hi AwesomeSauce, This comes up every so often!  Tableau ...READ MORE

answered Aug 14, 2018 in Tableau by Naruto
• 710 points
4,674 views
+1 vote
2 answers

How to join tables based on “Calculated Fields” in Tableau?

You absolutely can join to a calculated ...READ MORE

answered May 30, 2019 in Tableau by anonymous
24,575 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP