
1. Re: Calculation for a YearoverYear formula
Zhouyi Zhang Oct 23, 2019 5:18 PM (in response to Nicholas Gunadi)1 of 1 people found this helpfulHi, Nicholas
Try below calculation
sum([Date] = Today() then [Sales] end)
/
sum([Date] = Dateadd('year',1,Today()) then [Sales] end)
1
ZZ

2. Re: Calculation for a YearoverYear formula
Nicholas Gunadi Oct 23, 2019 5:35 PM (in response to Zhouyi Zhang)1 of 1 people found this helpfulHi Zhouyi,
inputting this into the calculated field gives me the 'expected closing parentheses or comma while parsing argument list for sum'
sum([Date] = Today() then [Sales] end)

3. Re: Calculation for a YearoverYear formula
Zhouyi Zhang Oct 23, 2019 5:40 PM (in response to Nicholas Gunadi)1 of 1 people found this helpfulHi, Nicholas
my bad, I forget add the "IF", below is the fixed calculation, let me know if any further issue
sum(If [Date] = Today() then [Sales] end)
/
sum(If [Date] = Dateadd('year',1,Today()) then [Sales] end)
1
ZZ

4. Re: Calculation for a YearoverYear formula
Nicholas Gunadi Oct 24, 2019 9:51 AM (in response to Zhouyi Zhang)1 of 1 people found this helpfulhi zhouyi,
the formula is perfect! another question though how do I handle this with aggregated calculations when calculating sales at a per unit level?
sum(If [Date] = Today() then sum([Sales])/sum([Units]) end)
/
sum(If [Date] = Dateadd('year',1,Today()) then sum([Sales])/sum([Units]) end)
1

5. Re: Calculation for a YearoverYear formula
Zhouyi Zhang Oct 24, 2019 4:24 PM (in response to Nicholas Gunadi)2 of 2 people found this helpfulHi, Nicholas
probably try this
{Fixed [Units]:sum(If [Date] = Today() then [Sales] end) }
/
{Fixed [Units]:sum(If [Date] = Dateadd('year',1,Today()) then [Sales] end)}
1
If this solves your question, please mark my answer either correct or helpful to close the thread. thx.
ZZ

6. Re: Calculation for a YearoverYear formula
Nicholas Gunadi Oct 24, 2019 5:13 PM (in response to Zhouyi Zhang)1 of 1 people found this helpfulhey zhouyi,
I finally figured out a way to bypass adding an aggregated formula:
// this is how to calculate per units (aggregates)
(
(sum(If [Date] = DATEADD('day',1,today()) then [Gross GP] end) / sum(If [Date] = DATEADD('day',1,today()) then [Units] end))

(sum(If [Date] = DATEADD('day',2,today()) then [Gross GP] end) / sum(If [Date] = DATEADD('day',2,today()) then [Units] end))
)
/
(sum(If [Date] = DATEADD('day',2,today()) then [Gross GP] end) / sum(If [Date] = DATEADD('day',2,today()) then [Units] end))

7. Re: Calculation for a YearoverYear formula
Zhouyi Zhang Oct 24, 2019 8:52 PM (in response to Nicholas Gunadi)1 of 1 people found this helpfulCool~~
ZZ