5 Replies Latest reply on Jul 17, 2017 7:51 AM by Beatriz Manzano

# Month To Date and Quarter To Date Calculation

All,

I am creating a report for our Operations division that gets sent out every week.

In this report, there are two fields that I need that I can't seem to figure out in tableau.

Note that I want these to be calculations that I can pull in from the measures shelf.

I need:

Month To Date Deliveries

Last Month To Date Deliveries

QTD Installs

QTD Deinstalls

How would I create these calculations?  Essentially, I can't figure out the MTD and QTD formulas when I try to create a calculated field.

Can someone help me figure these calculations out!?

Thanks!

• ###### 1. Re: Month To Date and Quarter To Date Calculation

Does this work?

MTD Deliveries = SUM(IF [Date] >= DATETRUNC('month',NOW()) AND [Date] < NOW() THEN [Deliveries] END)

QTD Installs = SUM(IF [Date] >= DATETRUNC('quarter',NOW()) AND [Date] < NOW() THEN [Installs] END)

etc.

If you alter these formulas you should be able to answer the 2 that I haven't done for you. Hope that works for you.

Andrew

• ###### 2. Re: Month To Date and Quarter To Date Calculation

Thank you.

Since I'm not as Tableau-saavy as I'd like to be yet, would you mind showing me for one of those how to do the Last Year portion of those calculations.

I tried, but wasn't successful.

Thanks!

Grant

• ###### 3. Re: Month To Date and Quarter To Date Calculation

Does this work? (Sorry, I haven't tested it)

Last Year MTD Deliveries = SUM(IF [Date] >= DATETRUNC('month',DATEADD('year',-1,NOW())) AND [Date] < DATEADD('year',-1,NOW()) THEN [Deliveries] END)

Andrew

1 of 1 people found this helpful
• ###### 4. Re: Month To Date and Quarter To Date Calculation

Looks like that did it!  Thanks for the help!

• ###### 5. Re: Month To Date and Quarter To Date Calculation

Very helpful! Thank you very much!