Articles in this section
Category / Section

Calculate the Difference Between Today and Yesterday Count Data with Expression in Bold BI

Published:

In many scenarios, it’s useful to compare metrics across different time periods directly within a dashboard. This article will guide you through the process of displaying the count difference between two consecutive days—today and yesterday—in a Grid widget. This can be particularly helpful for tracking daily metrics such as user sign-ups, sales, or any other data that is date specific.

Steps to Display Count Difference

To display the count difference between today and yesterday in a Grid widget, you will need to create expression columns that calculate the count for each day and the difference between them. Here’s how you can set this up:

1. Create an Expression to Calculate Today's Data Count

First, create an expression column to fetch the count value for today’s date. Use the following syntax for the expression:

SUM(IF([Date_Column]>=TODAY() AND [Date_Column]<TODAY()+1, [ColumnName], 0))

Replace [Date_Column] with the actual column name that contains the date information and [ColumnName] with the column that contains the data you want to count.
today-count-exp.png

2. Create an Expression to Calculate the Count of Data from Yesterday

Next, create an expression column to fetch the count value for yesterday’s date. Use the following syntax for the expression:

SUM(IF([Date_Column]>=YESTERDAY() AND [Date_Column]<TODAY(), [ColumnName], 0))

Again, replace [Date_Column] and [ColumnName] with the appropriate column names from your data source.
yesterday-count-exp.png

3. Calculate the Count Difference

Now, create an expression column to calculate the count difference between today and yesterday. This will involve subtracting the count for yesterday from the count for today.

count-difference-exp.png
4. Bind Expression Columns in Grid Widget

Finally, bind the created expression columns to the Grid widget to view the count difference result. This will allow you to visualize the data directly within your dashboard.

bind-grid-with-expressions.png

Using Expression Columns in KPI Card Widget

In addition to displaying this information in a Grid widget, you can also use these expression columns in a KPI card widget. This can be an effective way to highlight the count difference between today and yesterday in a more prominent and summarized format.

KPI-card-with-count.png

Additional References

For more detailed information on configuring expression columns and setting up widgets in your dashboard, refer to the following resources:

By following these steps, you can effectively track and display daily count differences in your dashboards, providing valuable insights into your data trends.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
SM
Written by Sammanasu Mary Jesuraj
Updated:
Comments (0)
Please  to leave a comment
Access denied
Access denied