1 2 Previous Next 15 Replies Latest reply on May 9, 2018 11:41 PM by Deepak Rai

# How to count First instance of value per window Year?

swaroop.gantela

I have the following issue:

I need to prioritize my alarms by year . So for example P1 = 2018, P2=2019, P3=2020. Then I need to count how many fall under each Priority.  I have done the following:

But If you notice,  I have duplicate of alarm count based on the projected date. How can I count the distinct first instance and associate it to the correct Priority.

For example if its projected to have an alarm on 2018,2019,2020, then I want to count the minimum year and associate it to P1.

Example2 :  Alarm projected on 2019,2020 then it should be P2.

Example3:  Alarm projected on 2020 then it should be P3.

I  have been trying multiple way and reading on different threads searhcing for something similar and I can't seem to find how to resolve this.

Any suggestion? I will truly appreciate it.  I am using Tableau 10.4

Thanks

• ###### 1. Re: How to count First instance of value per window Year?

Hi Felix,

hope it helps.

BR,

bharat

• ###### 2. Re: How to count First instance of value per window Year?

Create this Calc

{FIXED Unique:MIN(Projected Date)}=Projected Date

Drag it to Filter and Set TRUE

• ###### 3. Re: How to count First instance of value per window Year?

Hi,

Create the min(projecteddate) measure and use it with the unique dimension. Then it will give you the minimum value.

After this then use your calculation min(projecteddate)='2018' then 1 else 0 logic.

Regards,

Pavan

• ###### 4. Re: How to count First instance of value per window Year?

I've tried that  but it puts everything under P1 because it only shows values that had  2018.  But for values that only have 2019,2020 I want to show 2019.  But it still shows 2018.

• ###### 5. Re: How to count First instance of value per window Year?

I've tried that  but it puts everything under P1 because it only shows values that had  2018.  But for values that only have 2019,2020 I want to show 2019.  But it still shows 2018

• ###### 6. Re: How to count First instance of value per window Year?

Try This:

{FIXED Unique, ProjectedDate:MIN(Projected Date)}=Projected Date

If the above doesn't work then try this Too:

{FIXED Unique, ProjectedDate, Alarm Priority:MIN(Projected Date)}=Projected Date

If you attach some workbook with fake data, That would get you faster help

• ###### 7. Re: How to count First instance of value per window Year?

Thanks for the support. Attached is the workbook.

Regards

• ###### 8. Re: How to count First instance of value per window Year?

Here It is:

Create This Calc and Drag it to Filter and Set TRUE

Thanks

Deepak

If It Helps, Pl mark it Helpful and CORRECT to Close Thread

• ###### 9. Re: How to count First instance of value per window Year?

I don't understand why it keeps giving me 2018 values only!  . I recreated the workbook with anonimized data. Your calculation works on the fake workbook. But on my real data set it sets everything to 2018. I am perplexed right now.

Could there be something on my data that would not make this calculation work?

• ###### 10. Re: How to count First instance of value per window Year?

Just check if your anonimized data and real data look similar otherwise create another fake similar workbook and i would help

• ###### 11. Re: How to count First instance of value per window Year?

It is the same columns and everything. I just provided a subset of the data with different names. But the format and everything is exactly the same.

• ###### 12. Re: How to count First instance of value per window Year?

Hi Felix,

BR,

bharat

• ###### 13. Re: How to count First instance of value per window Year?

PL check attached in Version 10.2

• ###### 14. Re: How to count First instance of value per window Year?

So I published my dashboard on my server. then downloaded the data as a csv. re-did the worksheet and it works when I use the excel file.  Same data!

But on the original worksheet on my workbook the calculation doesn't work... I dont want to have to do this workaround to accomplish the view. Your calculation does exactly what I want. But my current workbook wont take the calculation how it should.  :/

1 2 Previous Next