6 Replies Latest reply on Jul 14, 2016 5:15 PM by Li Zhang

# calculate numbers of newly opened jobs month to date

Hi all,

I am trying to calculate numbers of newly opened jobs MTD. I used the following formulas but it didn't return any result:

IF ATTR(YEAR([Date Created]))=YEAR(TODAY()) AND ATTR(month([Date Created])=MONTH(TODAY())) THEN COUNTD([Job Code]) END

I have also tried the following and they all worked.

IF YEAR([Date Created])=YEAR(TODAY()) AND month([Date Created])=MONTH(TODAY()) THEN [Labour Cost] END

IF ATTR(YEAR([Date Created]))=YEAR(TODAY()) AND ATTR(month([Date Created]))=MONTH(TODAY())

THEN "new job opened" END

Now I am scratching my head and confused.

Hope someone can help!!

Thanks

• ###### 1. Re: calculate numbers of newly opened jobs month to date

Hello Li - change that Countd() to just return the field [Job Code] when that condition is true.

I would change this to be something like this example:

if datepart('year',[new order date])=datepart('year',today()) and datepart('month',[new order date])=datepart('month',today()) then [Customer ID] End

and then run your countd on the new created field.

see attached workbook example.

Maybe others will chime in with their own best ideas of how to do..  Rody Zakovich maybe?

Patrick

• ###### 2. Re: calculate numbers of newly opened jobs month to date

Hi Patrick,

I am only new to this forum and somehow I couldn't find your attachment.

Thanks,

Li

• ###### 3. Re: calculate numbers of newly opened jobs month to date

Hi Li,

It's just above you post. Please refer the below screenshot. Attachment is highlighted in Red color box.

Thanks and Regards,

Ashish Chaudhari

• ###### 4. Re: calculate numbers of newly opened jobs month to date

Thanks Ashish!

This sounds silly I couldn't login to Tableau Community at workplace today using usual browser so I used IE, where I couldn't see any attachment.

I will try again tmr.

Thank you

Kind Regards,

Li

• ###### 5. Re: calculate numbers of newly opened jobs month to date

• ###### 6. Re: calculate numbers of newly opened jobs month to date

Hi Patrick,

Thank you very much! this solved my puzzle!! It worked!!!

Another trick added onto my list of things to try when stuck. But what is the logic behind it? Why is that we had to separate the formula into two parts?

Kind Regards,

Li

PS: not sure what happened, I couldn’t log in at all using Microsoft Edge; I couldn’t reply message using google chrome; I couldn’t see online attachment using IE