1 2 3 Previous Next 34 Replies Latest reply on Jun 7, 2018 12:35 PM by rayvel.lopez Go to original post
• ###### 30. Re: Count each month greater than zero

His Sireesha,

Thank you for your last reply. You are correct, I should be more specific and understand my data structure.

The last code you sent me didn't work for me and reason is because of my data structure. If you don't mind let me provide you with example of my  data structure.

 Transaction  Post Date Charge Amount 6/1/2017 \$0.00 6/15/2017 \$0.00 6/25/2017 \$0.00 7/1/2017 \$0.00 7/15/2017 \$0.00 7/28/2017 \$0.00 8/1/2017 \$0.00 8/15/2017 \$0.00 8/30/2017 \$0.00 9/1/2017 \$0.00 9/15/2017 \$0.00 9/20/2017 \$0.00 10/2/2017 \$30.00 10/12/2017 \$10.00 10/15/2017 \$25.00 11/1/2017 \$17.00 11/14/2017 \$10.00 11/17/2017 \$0.00 12/1/2017 \$100.00 12/12/2017 \$15.00 12/17/2017 \$0.00 1/5/2018 \$10.00 1/6/2018 \$15.00 1/18/2018 \$0.00 2/2/2018 \$15.00 2/5/2018 \$0.00 2/8/2018 \$0.00 3/1/2018 \$5.00 3/9/2018 \$0.00 4/1/2018 \$10.00 4/15/2018 \$15.00 4/30/2018 \$0.00 5/1/2018 \$7.00 5/17/2018 \$0.00 5/30/2018 \$0.00
• ###### 31. Re: Count each month greater than zero

The Formula, I gave you earlier,  is working on this data set as well.  Attaching workbook in tableau 10.3

countd(IF DATEDIFF('month',[Date],TODAY())<=12

and

([Charge Amount]>0 )

then MONTH([Date]) END)

• ###### 32. Re: Count each month greater than zero

Hey Arvindgarg

The code is working but it's counting for the current month. How can I exclude current month? So, it should count from June2017-May2017.

Thank you

• ###### 33. Re: Count each month greater than zero

Do you mean June2017-May2018 ??  If this the case ----

you can also add modify your calculation like below

Both should give the same answer.

countd(IF DATEDIFF('month',[Date],TODAY())<=12  and DATEDIFF('month',[Date],TODAY())<> 0

and   ([Charge Amount]>0 )

then MONTH([Date]) END)

OR

countd(IF DATEDIFF('month',[Date],TODAY())<=12  and DATEDIFF('month',[Date],TODAY())>= 1

and  ([Charge Amount]>0 )

then MONTH([Date]) END)

• ###### 34. Re: Count each month greater than zero

Thank you very much.

1 2 3 Previous Next