This blog is inspired by blog: Top 15 Tableau LOD Expressions (Practical Examples).
Tableau LOD (Level of Detail) Expression is one of the most powerful tools to achieve amazing results in building dashboards. In this series of blogs, we will walk through 15 different use cases to demonstrate the usage of LOD expression.
Since this is a series blogs, please use the navigation below to jump to the one you need quickly:
Daily Profit KPI
When doing sales analysis, we may want to know the daily profit status over time and build a dashboard to monitor. In this example, we are going to build a dashboard of profitable days monitor to show the monthly profitable days for different profit categories.(I won’t set up the data connection here, and the dataset used in this series is always “Sample- Superstore”)
1.To get a number of profit in each month, the first thing to do is to get the profit for each day. But if we look at our data source, the profit is recorded at order level. So, we need to create a calculated field to find the profit for each day as shown in below image:
2. We want to give category these days by its profit value. Now let’s create a calculated field as shown in below image:
3. Now we want to construct the chart we wanted.
On Columns shelf, we want to put discrete Year and Month of “Order Date“, so the profitable days are aggregated at month level, and we could compare between years.
On Rows shelf, we want to see the days for each profit category and show the value of days overtime.
The “Profit Days” on the Rows shelf is defined as below. This measure is used for count days of each month and also profit categories. To show “0” for the month without profitable days, I use “ZN” function.
4. Now we need to select “Area” chart in the Mark card and color it by “Profit Category“, and we can get a chart as shown below:
At last, we need to do some formatting and publish our work. You could check my work in Tableau public and hope you like it.