-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Average Calculation Error? #315
Comments
Do you have data for every day? I think it might have issues if you miss a day (so if there are only 29 files it will calculate the average differently than if you had 30). I'll have to double check the code, but it might also be counting "today" differently than expected. |
Can confirm I have a complete dataset as you can see from this:
[image: image.png]
I will need to go back and add the individual values together but it
appears that the 7 day total is about right but the 30 day total is much
lower than it should be.
Here is my code for the above rendering. I can't see a problem but if I've
got something in error please let me know.
```tracker
searchType: frontmatter
searchTarget: Steps
datasetName: Steps
folder: • Calendar/Journal/Daily
startDate: -30D
endDate: +0d
fixedScale: 1.0
line:
fillGap: true
yAxisLabel: Steps
yMin: 0
yMax: 12000
xAxisLabel: ""
lineColor: "#db5c97"
showPoint: false
xAxisColor: "#C4B1E6"
yAxisColor: "#C4B1E6"
yAxisLabelColor: "#C4B1E6"
```
```tracker
searchType: frontmatter
searchTarget: Steps
datasetName: Steps
folder: • Calendar/Journal/Daily
startDate: 2024-01-01
endDate: 2024-12-31
summary:
template: "Max.: {{max(dataset(0))::i}}"
```
```tracker
searchType: frontmatter
searchTarget: Steps
datasetName: Steps
folder: • Calendar/Journal/Daily
startDate: 2024-01-01
endDate: 2024-12-31
summary:
template: "Min.: {{min(dataset(0))::i}}"
```
```tracker
searchType: frontmatter
searchTarget: Steps
datasetName: Steps
folder: • Calendar/Journal/Daily
startDate: -30D
endDate: +0D
summary:
template: "Average: {{average(dataset(0))::i}}"
```
```tracker
searchType: frontmatter
searchTarget: Steps
datasetName: Steps
folder: • Calendar/Journal/Daily
startDate: -7D
endDate: +0D
summary:
template: "Last 7 Days: {{sum(dataset(0))::i}}"
```
```tracker
searchType: frontmatter
searchTarget: Steps
datasetName: Steps
folder: • Calendar/Journal/Daily
startDate: -30D
endDate: +0D
summary:
template: "Last 30 Days: {{sum(dataset(0))::i}}"
```
…On Tue, Feb 27, 2024 at 11:34 AM Joe Constant ***@***.***> wrote:
Do you have data for every day? I think it might have issues if you miss a
day (so if there are only 29 files it will calculate the average
differently than if you had 30). I'll have to double check the code, but it
might also be counting "today" differently than expected.
—
Reply to this email directly, view it on GitHub
<#315 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACOXZNPIRFDWGY4NW3NNLK3YVUZ3FAVCNFSM6AAAAABDCGZEPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRVGYZTEMZUGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Cheers
Mal Evans
|
NOTE: Your image didn't come through in your email so I am not able to see what your dataset looks like. In which case, it's possible the below isn't helpful. I double checked and the average function works as I said. Here's the function:
So the way you have it configured it says:
So, if in the last 30 days you had 5 entries:
Having an entry of 0 is still having an entry. If you have a day where there is no entry at all (or you don't have a file for that day), then it won't count in the average. If you have 30 days worth of files, please make sure every file has a non-blank entry For the data above, the sum would be 123+45+67+89 = 324 |
I'm tracking my steps and have the following code for the sum and average values over the last 30 days
The text was updated successfully, but these errors were encountered: