VizWiz

Launch, grow, and unlock your career in data
Showing posts with label datepart. Show all posts

January 31, 2023

How to Calculate Day over Day Change Excluding Weekends

No comments

In a previous tip, I showed you how to calculate day over day change and build 3 KPI cards.

However, this does not cover the case when you need to ignore weekends. In this #Tableau tip, I show you how to calculate daily change excluding the weekends.

You can copy/paste the calculations from below the video. Enjoy and good luck!


Calculations

  1. Latest Day
    {MAX([Order Date])}

  2. Weekday for Latest Day
    DATEPART('weekday',[1. Latest Day])

  3. Sales for Latest Day
    INT([Order Date]=[1. Latest Day])*[Sales]

  4. Previous Day
    IF [2. Weekday for Latest Day]=2
    THEN [1. Latest Day]-3
    ELSE [1. Latest Day]-1
    END

  5. Sales for Previous Day
    INT([Order Date]=[4. Previous Day])*[Sales]

  6. DoD Change
    SUM([3. Sales for Latest Day])-SUM([5. Sales for Previous Day])

  7. DoD Change %
    [6. DoD Change]/SUM([5. Sales for Previous Day])

  8. Positive Change
    [7. DoD Change %]>0

September 2, 2022

5 Most Common Date Functions in Tableau

No comments

In this tip, I take you through the 5 most common date functions in Tableau:

  1. DATEPART
  2. DATENAME
  3. DATETRUNC
  4. DATEADD
  5. DATEDIFF

By the end of this video you will understand when to use them to meet your use case. Click here for the cheat sheet I created for these date calculations.