Quantcast
Channel: InterWorks
Viewing all articles
Browse latest Browse all 2716

Advance with Assist: NOW and TODAY Functions in Tableau

$
0
0
NOW and TODAY functions in Tableau

Question: I’m using the NOW function to show the current date and time in an analysis I’m building for our assembly line, but when I add to my report, it’s showing me all data for all of time. How can I get this to show me only what’s current?

The NOW function returns the current date and time. It’s a nice function for use in time-sensitive analyses since it gives you the ability to grab the current date and time:

NOW function in Tableau

When I place this in Tableau, it gives me the current date and time. So you can see that I’m writing this blog on 4/22 at 10:34:

NOW function in Tableau

For the purposes of answering this question, I’ll be using Superstore as my dataset. When I add sales to my report, NOW updates, but it shows the full year like in our original Assist request:

NOW function in Tableau

The key here is understanding what you’ve built in Tableau. You are adding metadata to every row in the database, but the NOW function is a constant for the workbook and will repeat on every row of data. TODAY is another common function for grabbing the current date when time isn’t important when loading a dashboard. I’ll add Order Date to the view to illustrate this:

NOW and TODAY functions in Tableau

In discussing this request with the user, what they were after was how many products had been produced since the beginning of the shift. They had a column in their data with the shift start date and time and wanted now to show the accumulation.

To attain the desired result, we used the following:

  • a calculated field with the shift start-time field that had been selected via filter
  • the NOW field to create a Boolean calculation we could then select TRUE for

[Product Produce Timestamp] >= [Shift Start] AND [Product Produce Timestamp] <= [NOW]

The post Advance with Assist: NOW and TODAY Functions in Tableau appeared first on InterWorks.


Viewing all articles
Browse latest Browse all 2716

Trending Articles