Forum Discussion
Simple Rolling Sum not summing correctly
Hi All,
I have been struggling to get my Rolling Sum Running despite doing it multiple different ways. It seems that its not picking up all the dates that are within the period that i have asked for.
For context, I have 60min rainfall data that is being live streamed from a rain gauge in direct query, the data is then pulled into multiple different graphs like hourly rainfall (Raw) and Daily averages (bins) and lastly rolling averages(which is failing).
The data is simply a datetime column 'Rain gauge[NZDT]' and a rainfall column 'Rain gauge'[Hourly Rainfall]'
Here is my Measure (i cannot use calulated columns because of direct query) :
As i said, i have also tried:
All do not seem to grab the data,
Any help would be much appreciated 🙂
9 Replies
- lbendlinSuper User
I would put the SELECTEDVALUE('Rain gauge'[NZDT] as variable in front of the Calculate.
If you can post some sample data this should be a quick one.
- MatteMattoFrequent Visitor
Hi there,
I messe up and it turns out i cant use the datesbetween because of duplicates in the table, i suspect this is because my data comes as hourly and not daily. however this is the one below that also returns the same, i have altered it as you have said with no luck.
I have just tried this:
Running_Total =var thispoint = SELECTEDVALUE('Rain gauge'[NZDT])returnCALCULATE (SUM ( 'Rain gauge'[Hourly Rainfall]),FILTER (ALL('Rain gauge'),'Rain gauge'[NZDT] <= thispoint),FILTER (ALL('Rain gauge'),'Rain gauge'[NZDT] >= thispoint - 1))The same answer is coming up, sample data below for the last dayInstallation NZDT Rain Rain Gauge 2020-06-18 11:04:15.000 +12:00 2 Rain Gauge 2020-06-18 10:04:15.000 +12:00 0.4 Rain Gauge 2020-06-18 09:04:16.000 +12:00 0.4 Rain Gauge 2020-06-18 08:04:15.000 +12:00 1.4 Rain Gauge 2020-06-18 07:04:15.000 +12:00 0.2 Rain Gauge 2020-06-18 06:04:15.000 +12:00 1.8 Rain Gauge 2020-06-18 05:04:14.000 +12:00 1.8 Rain Gauge 2020-06-18 04:04:15.000 +12:00 1.2 Rain Gauge 2020-06-18 03:04:15.000 +12:00 1 Rain Gauge 2020-06-18 02:04:15.000 +12:00 0.6 Rain Gauge 2020-06-18 01:04:15.000 +12:00 0.2 Rain Gauge 2020-06-18 00:04:14.000 +12:00 0 Rain Gauge 2020-06-17 23:04:15.000 +12:00 0 Rain Gauge 2020-06-17 22:04:14.000 +12:00 0 Rain Gauge 2020-06-17 21:04:14.000 +12:00 0 Rain Gauge 2020-06-17 20:04:14.000 +12:00 0 Rain Gauge 2020-06-17 19:04:15.000 +12:00 0.2 Rain Gauge 2020-06-17 18:04:15.000 +12:00 0 Rain Gauge 2020-06-17 17:04:18.000 +12:00 0 Rain Gauge 2020-06-17 16:04:14.000 +12:00 0 Rain Gauge 2020-06-17 15:04:14.000 +12:00 0 Rain Gauge 2020-06-17 14:04:15.000 +12:00 0 Rain Gauge 2020-06-17 13:04:14.000 +12:00 0 Rain Gauge 2020-06-17 12:04:14.000 +12:00 0 - MatteMattoFrequent VisitorAmendments made to this one below, still no luck.Running_Total =var thispoint = SELECTEDVALUE('Rain gauge'[NZDT])returnCALCULATE (SUM ( 'Rain gauge'[Hourly Rainfall]),FILTER (ALL('Rain gauge'),'Rain gauge'[NZDT] <= thispoint),FILTER (ALL('Rain gauge'),'Rain gauge'[NZDT] >= thispoint - 1))
Installation NZDT Rain Rain Gauge 2020-06-18 11:04:15.000 +12:00 2 Rain Gauge 2020-06-18 10:04:15.000 +12:00 0.4 Rain Gauge 2020-06-18 09:04:16.000 +12:00 0.4 Rain Gauge 2020-06-18 08:04:15.000 +12:00 1.4 Rain Gauge 2020-06-18 07:04:15.000 +12:00 0.2 Rain Gauge 2020-06-18 06:04:15.000 +12:00 1.8 Rain Gauge 2020-06-18 05:04:14.000 +12:00 1.8 Rain Gauge 2020-06-18 04:04:15.000 +12:00 1.2 Rain Gauge 2020-06-18 03:04:15.000 +12:00 1 Rain Gauge 2020-06-18 02:04:15.000 +12:00 0.6 Rain Gauge 2020-06-18 01:04:15.000 +12:00 0.2 Rain Gauge 2020-06-18 00:04:14.000 +12:00 0 Rain Gauge 2020-06-17 23:04:15.000 +12:00 0 Rain Gauge 2020-06-17 22:04:14.000 +12:00 0 Rain Gauge 2020-06-17 21:04:14.000 +12:00 0 Rain Gauge 2020-06-17 20:04:14.000 +12:00 0 Rain Gauge 2020-06-17 19:04:15.000 +12:00 0.2 Rain Gauge 2020-06-17 18:04:15.000 +12:00 0 Rain Gauge 2020-06-17 17:04:18.000 +12:00 0 Rain Gauge 2020-06-17 16:04:14.000 +12:00 0 Rain Gauge 2020-06-17 15:04:14.000 +12:00 0 Rain Gauge 2020-06-17 14:04:15.000 +12:00 0 Rain Gauge 2020-06-17 13:04:14.000 +12:00 0 - lbendlinSuper User
Just tried your Running Total query and it seems to work fine. How does it look on your side?