Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All, I need to do something it may be simple but so far I'm no able to get it. So basically what I want is illustrated in the "AccumulatedCount" column below:
Key | StartDate | EndDate | Count | AccumulatedCount |
---|---|---|---|---|
1 | 10/02/2018 | 12/02/2018 | 1 | 1 |
3 | 11/02/2018 | 13/02/2018 | 1 | 2 |
4 | 12/02/2018 | 14/02/2018 | 1 | 3 |
5 | 13/02/2018 | 15/02/2018 | 1 | 4 |
5 | 14/02/2018 | 16/02/2018 | 1 | 5 |
The closest shoot I got so far is use this expression:
if(StartDate< Previous(EndDate), Count+1, Previous(Count)) AS AccumulatedCount
But, of course that's not what I want cause I'm summing 1 to 1 all the time:
Key | StartDate | EndDate | Count | AccumulatedCount |
---|---|---|---|---|
1 | 10/02/2018 | 12/02/2018 | 1 | 1 |
3 | 11/02/2018 | 13/02/2018 | 1 | 2 |
4 | 12/02/2018 | 14/02/2018 | 1 | 2 |
5 | 13/02/2018 | 15/02/2018 | 1 | 2 |
5 | 14/02/2018 | 16/02/2018 | 1 | 2 |
So I need something like that expression but over the AccumulatedCount field but not sure how to do it. Hope it makes sense.
Cheers,
Andrés
Although if I tried to applied the date logic to it or put it into the script I fail miserably:
if([Session Start]< Above([Session End]), RangeSum(Above(TOTAL SessionCount,0, RowNo(TOTAL))), Above(SessionCount)) // Chart Not working
if([Session Start]< Previous([Session End]), RangeSum(Peek(SessionCount,0, RowNo())), Peek(SessionCount)) AS RollingSessionCount // Script Not working
Yes, indeed that's not what I really want, but it's a step forward. I'll try to figure it out playing around yest.
May be provide few rows of data where the condition is met and where the condition isn't met and then share the output you expect to see from it?
Sure, this is an xlsx sample file and the image below explains what I want:
Hope it makes sense
Try this
Table:
LOAD StartDate,
EndDate,
Session
FROM
[..\..\Downloads\AccumulatedCount.xlsx]
(ooxml, embedded labels, table is Sheet1);
FinalTable:
LOAD *,
If(StartDate <= Previous(EndDate), RangeSum(Peek('Accu'), Session), Alt(Peek('Accu'), Session)) as Accu
Resident Table
Order By StartDate;
DROP Table Table;