Hi QuickSight Community!
I have a question about the level-aware calculation/table calculation that I’ve been stuck for a while and need your help.
here’s the sample of data:
Flow--------------------------------Sales Amount
US > New Customer > Desktop—$6,500
Jan 28, 2024-----------------------$1,800
Feb 4, 2024------------------------$1,200
Feb 11, 2024-----------------------$1,500
Feb 18, 2024-----------------------$2,000
Note: Sales Amt is calculated at the “Flow” and “Week” level, there’re multiple flows in the data
For all the 4 weeks Sales data, I want to calculate
(1) Latest week’s Sales Amt
(2) Previous 3 week’s Sales Amt
(3) Difference between 1) & 2)
I am able to get 1) & 2), but when doing 3) which is 1) - 2), the number doesn’t show up on the table.
Here are the formula I’m using:
(1) sum(ifelse({week}={latest_week},{sales_amt},NULL),[{Flow},{week}])
(2) sum(ifelse({week}<>{latest_week},{sales_amt},NULL),[{Flow},{week}])/3
(3) sum(ifelse({week}={latest_week},{sales_amt},NULL),[{Flow},{week}]) - sum(ifelse({week}<>{latest_week},{sales_amt},NULL),[{Flow},{week}])/3
(1) & (2) is showing the correct results but 3) is blank on the dashboard like below:
|Flow------------------------------|1) Latest Week Sales|2) Avg of Previous Weeks’ Sales|Diff of 1) and 2)|
|US > New Customer > Desktop|$2,000----------------|$1,500-----------------------------|(Blank)----------|
Can someone help me with the 3) calculation? I’ve tried pre_agg/post_agg_filter but can’t tweak the formula to get the correct result
Thanks in advance!