I want to make a calculation for volume, mix and pricing effects for our assortment.
I use this formula to calculate the impact on the gross margin for the two compared periods:
- Period 1 = last year previous month (=March 2024)
- Period 2 = last month (= March 2025)
On line level for each SKU it works well with correct values with this formula, but not in total sums aggregated:
(
(
sumIf({Calc. value ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-12,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-13,‘MM’, now() ) ) ) / sumIf({# Products ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-12,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-13,‘MM’, now() ) ) )
“*”
sumIf({# Products ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-0,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-1,‘MM’, now() ) ) )
)
“-”
(
sumIf({Calc. value ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-12,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-13,‘MM’, now() ) ) ) / sumIf({# Products ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-12,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-13,‘MM’, now() ) ) )
“*”
sumIf({# Products ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-12,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-13,‘MM’, now() ) ) )
)
)
/
(
sumIf({Calc. value ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-12,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-13,‘MM’, now() ) ) ) / sumIf({# Products ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-12,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-13,‘MM’, now() ) ) )
“*”
sumIf({# Products ordered}, {Order date}< truncDate( ‘MM’, addDateTime(-12,‘MM’, now() ) ) AND {Order date}>= truncDate( ‘MM’, addDateTime(-13,‘MM’, now() ) ) )
)
PS: “” need to ignored - without them i always get a bullet list mark in my formula.
I also tried it in different steps with calculated fields, but it also does not work.
I have exported everything to excel and everything is correct except the aggregation (red boxes are the manually calculated values in Excel - red marked the wrong Quicksight calculation.
Could you help me with it?
Thanks in advance!