Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rollback 28 first times with expression

How to do a rollback for the first 28 times/days in which Promo ={0} ?

I use the following expression to calculate an average rolling back 28 days

((Sum({<Promo ={0},DateTest={">=$(=Date(Today() - 30)) <$(=Date(Today()-2))"}>} [Prix de vente TTC]))/28 )

My problem if the first 28 days Promo <> {0} for example , the resultas will be false ?

3 Replies
sunny_talwar

May be this:

If(Promo = 0, ((Sum({<Promo ={0},DateTest={">=$(=Date(Today() - 30)) <$(=Date(Today()-2))"}>} [Prix de vente TTC]))/28))

Anonymous
Not applicable
Author

Date(Today() - 30) is the problem , the value 30 should be dynamically changed . In case in rolling back 60 days I will get 28 days in which Promo= {0} so my expression will be

((Sum({<Promo ={0},DateTest={">=$(=Date(Today() - 60)) <$(=Date(Today()-2))"}>} [Prix de vente TTC]))/48 )

sunny_talwar

Would you be able to share some sample data to see what you are trying to do? It is rather difficult to understand what you are trying to do, just by looking at your expression.