5 Replies Latest reply on Sep 23, 2015 7:33 AM by Felix Curran

# Calculation for Number of Days with Value

Tableau Community,

I have asked a question regarding this same workbook in The specified item was not found.. This question relates to a different KPI that I need, meaning that I lied when I said "I have all of the other KPIs into their own calculated fields which is great". Sorry!

I want to have a calculated field that will return the number of days where there are one or more records. For the example below the calculation would return 3 for User1, 5 for User2, and 4 for User3.

I have attached the .twbx for you to experiment with.

This is in Tableau 8.2.

Felix

• ###### 1. Re: Calculation for Number of Days with Value

Felix,

I don't know if I misunderstood your question but can't you just place CNTD(Date) on text in the marks card?

• ###### 2. Re: Calculation for Number of Days with Value

hi Felix,

I'm afraid I can only go back to 8.3! so can't  post you a workbook you could open, but I think

COUNTD([Date])

will do the trick.

Let me know if not, and if so why and I'm sure we can get an iteration of this that will work...For example we might need a further condition COUNTD(IIF(NOT(ISNULL([SomeValue])),[Date],NULL)

1 of 1 people found this helpful
• ###### 3. Re: Calculation for Number of Days with Value

I'm a bit embarrassed to even reply to this... But that simple answer is what I needed. I can't believe that passed me by! Whoops.

Thanks for the nice a simple answer, and for your quick replies!

Regards,

Felix

• ###### 4. Re: Calculation for Number of Days with Value

No problem...It's only obvious when you see it!...many times I've been deep in analysis and end up trying to calculate something I think is going to be very complicated, and think I've achieved some sort of genius moments with a super-complicate-nested-table-calc...only for someone in the office (usually while I'm bragging about by Table Calc guru-ness!) to point out...'Yes but isn't that just the SUM of  the Number of Records'....

• ###### 5. Re: Calculation for Number of Days with Value

Glad to hear I'm not the only one who likes to overcomplicate things!

Cheers again for the answer.