
1. Re: Last 30 days calculation
Zhouyi Zhang Nov 5, 2017 3:42 AM (in response to Matan Bracha)Hi, Matan
What I will suggest is use LOD.
e.g. yesterday
{Fixed: date([your date feild]):sum(if [your date field] = dateadd('day',1, today()), then [Daily Connected Accounts] end)}
and last 30 days
{Fixed: date([your date feild]):sum(if [your date field] >= dateadd('day',30, today()), then [Daily Connected Accounts] end)}
Hope this could give you some idea
ZZ

2. Re: Last 30 days calculation
Matan Bracha Nov 5, 2017 5:27 AM (in response to Zhouyi Zhang)Hi.
First of all  Thanks for the answer!
but when I try: {Fixed: date([Date]):sum(if [Date] >= DATEADD('day',30, today()), then [Daily Connected Accounts] end)}
OR {Fixed: [Date] : WINDOW_SUM(SUM([Daily Connected Accounts]), 30, 0)}
I get the same error  "expected '}' following the expression, with the red mark under the colon.


4. Re: Last 30 days calculation
Matan Bracha Nov 5, 2017 6:58 AM (in response to Jim Dehner)Thanks, it did help the calculation!
BUT  it still didn't help me solve my problem...
The calculation in Zhouyi Zhang answer gave me the same value as for a regular SUM([Daily Connected Accounts]), and what I tried (WINDOW_SUM) can't be inside FIXED calculation ("Level of detailed expressions cannot contain table calculations or the ATTR function)
So matbe you have another solution? :\
Thanks!

5. Re: Last 30 days calculation
Jim Dehner Nov 5, 2017 7:12 AM (in response to Matan Bracha)So did you try what ZZ sent but with the correct syntax

6. Re: Last 30 days calculation
Matan Bracha Nov 5, 2017 9:15 AM (in response to Jim Dehner)Yes  I got the same value as the regular SUM([Daily Connected Accounts]).
Because this is what the calculation does  it sums per date, if the date is from the last 30 days  it doesn't sums up the last 30 days (as WINDOW_SUM does).
As I said before  the WINDOW_SUM calculation problem is that it's filtered with the date filter... So I can't actually get the last 30 days sum.
Still looking for other solutions if you have ones...
Thanks!


8. Re: Last 30 days calculation
Zhouyi Zhang Nov 5, 2017 10:38 PM (in response to Matan Bracha)Hi, Matan
Don't use window_sum() in this case, just create two calculation fields as I suggested and drag them to the view.
It will be very helpful if you could share a workbook with dummy data but reflect your issue.
ZZ