Calculate percentage of gains in Atlas Charts

As you probably figured out, you can’t use a normal Charts date filter since it doesn’t put it at the right point of the pipeline. However you should be able to do something like this:

{
          $match: {
            date: {
              $gt: {
                $dateTrunc: {
                  date: "$$NOW",
                  unit: "day"
                }
              }
            }
          }
        }
1 Like