Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i´m experiencing some problems related to the use of this function with set analysis.
My requeriment is to calculate the sum of sales in a three month period of time based in the Start Date of a Campaign.
I have this data:
id | SalesDate | Sales |
1 | 20180101 | 0 |
1 | 20180201 | 10.000 |
1 | 20180301 | 40.000 |
1 | 20180401 | 50.000 |
So, the result for Id=1 should be 50.000 when selecting 20180101
But i can´t get this value. My attempts are:
- sum({$<SalesDate={">=$(=20180101)<=$(=20180301)"}>}Sales)
This goes ok. Result=50.000
- sum({$<SalesDate={">=$(=Date(Start_Date))<=$(=20180301)"}>}Sales)---->Start_Date=20180101 in this case.
This goes ok. Result=50.000
- sum({$<SalesDate={">=$(Date(Start_Date))<=$(AddMonths(Date(Start_Date),2))"}>}Sales)
--->AddMonths(Date(Start_Date),2)=20180301 in this case.
This goes wrong. Result=100.000
It seems AddMonths function is not working. Any idea would be appreciated.
Thanks in advance.
Regards.
Almost got it.
I´ve changed the scritp and now they´re connected.
If i select ID 1 it works. If i don´t select anything, the result is 0.
I need the table complete, without selecting anything.
I think I´ve found the solution.
It seems Set Analysis is not applicable to this situation. Just if a record or a date is selected, but with no selection it doesn´t work. Changing it for an if function, it works very well.
Thank you very much for all the answers. They helped me a lot.