Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rahul16051990
Contributor
Contributor

Take the sum between two Dates

I have dataset which contains OrderDate wise Sales. Requirement is to show sum of sales from OrderDate to last 30 Days. I tried mutiple solutions provided on Portal but no luck. 

I tried expression like:

sum({<StartDate= {"<=$(=min(OrderDate))>=$(=max(DaysBack30))"}> } [Monthly Sales In Volume])

using variables:

SUM({$<StartDate = {">= '$(vStart)'<='$(vEnd)'}>} [Monthly Sales In Volume])

I tried by creating variables 

Sample datset is given below:

Sales is OrderDate wise sales. If user clicks on 01/01/2018 then sales should be displayed between 01/01/2018 to 01/12/2017 for that particular product.

OrderDate      ProductID    DaysBack30    Sales

01/01/2018   10000018   01/12/2017              550

01/01/2018   10000017   01/12/2017              350

12/01/2018   10000018   12/12/2017              2000

13/01/2018   10000019   13/12/2017              550

Labels (3)
1 Reply
jonathandienst
Partner - Champion III
Partner - Champion III

Depending on how your date is defined, you might need to add Date() format statements:

Sum({<StartDate= {"<=$(=Date(Min(OrderDate))) >=$(=Date(Max(DaysBack30)))"}>} [Monthly Sales In Volume])

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein