Yes, partitioning by sort center and date will change the formulas. You’ll need to incorporate the partitioning into your calculations to ensure the DPMO is calculated correctly for each sort center and date combination. Here’s how you can adjust the formulas accordingly:
- Create Parameters for Date Ranges:
- Go to the Parameters section in QuickSight.
- Create two parameters for the start dates (
startDate1
, startDate2
) and two for the end dates (endDate1
, endDate2
).
- Create Control for Parameters:
- Add controls for these parameters so users can select the date ranges.
- Filtered Calculated Fields with Partitioning:
- Create calculated fields to filter the
pkg_missort_count
and total_pkg_count
based on the selected date ranges and partitioned by sort center and date.
For the first date range:
sumIf(
{pkg_missort_count},
{date_field} >= ${startDate1} and {date_field} <= ${endDate1} and {sort_center} = {sort_center}
) / maxIf(
{total_pkg_count},
{date_field} >= ${startDate1} and {date_field} <= ${endDate1} and {sort_center} = {sort_center}
) * 1,000,000
For the second date range:
sumIf(
{pkg_missort_count},
{date_field} >= ${startDate2} and {date_field} <= ${endDate2} and {sort_center} = {sort_center}
) / maxIf(
{total_pkg_count},
{date_field} >= ${startDate2} and {date_field} <= ${endDate2} and {sort_center} = {sort_center}
) * 1,000,000
- Create Calculated Fields for DPMO with Partitioning:
- Create calculated fields for DPMO for each date range, partitioned by sort center and date.
For the first date range:
ifelse(
{date_field} >= ${startDate1} and {date_field} <= ${endDate1} and {sort_center} = {sort_center},
(sum({pkg_missort_count}) over (partition by {sort_center}, {date_field}) / max({total_pkg_count}) over (partition by {sort_center}, {date_field})) * 1,000,000,
NULL
)
For the second date range:
ifelse(
{date_field} >= ${startDate2} and {date_field} <= ${endDate2} and {sort_center} = {sort_center},
(sum({pkg_missort_count}) over (partition by {sort_center}, {date_field}) / max({total_pkg_count}) over (partition by {sort_center}, {date_field})) * 1,000,000,
NULL
)
- Create a Table Visual:
- Add a new table visual to your analysis.
- Add the calculated fields for DPMO to this table.
- Calculate the Difference and Percentage Change with Partitioning:
- Create new calculated fields for numeric and percentage differences between the two DPMO values, partitioned by sort center.
Numeric difference:
sum(
ifelse(
{date_field} >= ${startDate1} and {date_field} <= ${endDate1} and {sort_center} = {sort_center},
(sum({pkg_missort_count}) over (partition by {sort_center}, {date_field}) / max({total_pkg_count}) over (partition by {sort_center}, {date_field})) * 1,000,000,
NULL
)
) - sum(
ifelse(
{date_field} >= ${startDate2} and {date_field} <= ${endDate2} and {sort_center} = {sort_center},
(sum({pkg_missort_count}) over (partition by {sort_center}, {date_field}) / max({total_pkg_count}) over (partition by {sort_center}, {date_field})) * 1,000,000,
NULL
)
)
Percentage difference:
(sum(
ifelse(
{date_field} >= ${startDate1} and {date_field} <= ${endDate1} and {sort_center} = {sort_center},
(sum({pkg_missort_count}) over (partition by {sort_center}, {date_field}) / max({total_pkg_count}) over (partition by {sort_center}, {date_field})) * 1,000,000,
NULL
)
) - sum(
ifelse(
{date_field} >= ${startDate2} and {date_field} <= ${endDate2} and {sort_center} = {sort_center},
(sum({pkg_missort_count}) over (partition by {sort_center}, {date_field}) / max({total_pkg_count}) over (partition by {sort_center}, {date_field})) * 1,000,000,
NULL
)
)) / sum(
ifelse(
{date_field} >= ${startDate2} and {date_field} <= ${endDate2} and {sort_center} = {sort_center},
(sum({pkg_missort_count}) over (partition by {sort_center}, {date_field}) / max({total_pkg_count}) over (partition by {sort_center}, {date_field})) * 1,000,000,
NULL
)
) * 100
- Add the Difference Fields to the Table:
- Include these calculated fields in your table to show the numeric and percentage differences.
By following these steps, you can create a view in QuickSight that partitions the calculations by sort center and date, allowing for accurate comparisons of DPMO values across different date ranges.