Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Karl_Hart
Creator
Creator

Set Analysis Dates Issue

All,

I have a requirement to show all transactions on the last date before a selected date. So I have a variable vDate which the user can select.

I then calculated the last date before the selected date

     Max({<IndexDate = {'<$(=Date($(vDate)))'}>}IndexDate))

I think want to use this within set analysis to sum the sales on that date

     sum({$<IndexDate={"=$(=Max({<IndexDate = {'<$(=Date($(vDate)))'}>}IndexDate))"}>} Sales)

Please see attached. This works when I put less than or greater than in the expression but not equals.

     sum({$<IndexDate={">=$(=Max({<IndexDate = {'<$(=Date($(vDate)))'}>}IndexDate))"}>} Sales)

     sum({$<IndexDate={">=$(=Max({<IndexDate = {'<$(=Date($(vDate)))'}>}IndexDate))"}>} Sales)

My questions:

     1. Can anyone explain why its not working or correct my "equals" formula

     2. Also, if there is a better way of doing this, I'm open to suggestions

I've attached a simple example, as ever the loaded data is vastly more complicated

Thanks,

Karl !

10 Replies
sunny_talwar

Are you looking for something like this?

Capture.PNG

=FirstSortedValue(DISTINCT {<IndexDate = {"<$(=Date($(vDate)))"}>} Aggr(Sum({<IndexDate = {"<$(=Date($(vDate)))"}>} Sales), IndexDate, Company), -Aggr(Only({<IndexDate = {"<$(=Date($(vDate)))"}>} IndexDate), IndexDate, Company))