# Adding time variable to graphs

I am not sure if this is possible yet but I want to add a chart that shows data for the last 30 days vs the lifetime of the info.

Is there a way to make the data time-sensitive.

1 Like

Iâd love this

Hi Gera,

As of now I donât think this is doable just inside Glide, but hereâs a workaround.

I have some random data like column A and B, then in column C I put this in the first cell.

``````={"Date type";ARRAYFORMULA(IF(A2:A<>"",IF(A2:A>=TODAY()-30,"Within 30 days","Not in last 30 days"),""))}
``````

It would result in something like this.

Then you can make a chart with it, with the lifetime total value showed in the center.

Hope it helps.

1 Like

You are the MAN! This is super helpful. For some reason, I am getting #REF! Error though. Am I stuck writing a complex formula for this or can I break it out a bit?

Here is the end game:
Reviews Today
Reviews Yesterday
Reviews Over The Last 7 days
Reviews Over The Last 14 days
Reviews Over The Last 30 days

Reviews This Month
Reviews Last Month
Reviews in 2020
Reviews in 2019

1 Like

@ThinhDinh
Update:
I got the formula working for some reason though when I turn it into a chat it gives me some bogus numbers. It works in pie chart mode. If I wanted to add a bunch of my variables how would I edit your original formula?

By the way you are a boss and this was super helpful.

1 Like

How many variables do you want to add? It would be complex, but itâs doable if we get the right logic.

Currently, I am looking at 9.

Here is how far I have gotten it.
={âDate typeâ;ARRAYFORMULA(IF(
E2:E<>"", E2:E<>"",IF(E2:E>=TODAY()-30, ,IF(E2:E>=TODAY()-7,
âWithin 7 daysâ,âWithin 30 daysâ,âNot in last 30 daysâ,âNot in last 7 daysâ)
,""))}

What is " E2:E<>" doing?

That is part 3.3 in my writeup here.

Hi Gera, based on the variables you have listed out I have made a sheet for you. I think it would be better to divided it into 4 columns:

• Recent: Yesterday & Today
• By days: Last 7, 14 and 30 days
• By month: This month & Last month
• By year: This year & last year

You can view the formulas in the header row of each column.

1 Like

looking around to learn some more abouth this feature

1 Like

Related to the use of date to filter a chart, if youâre interested.

1 Like

@ThinhDinh You are a data modeling wizard! Thank you for putting the functions together for me.

1 Like

My pleasure to help, feel free to put more questions if you need help, here or via personal message!

@ThinhDinh if you like I can show you the app I am working on in Glide itâs really cool and uses data I am gathering from another application and builds a back end around it. I would love your feedback on how I can make it even better.

1 Like

Feel free to show it here, I would love to learn from you and others as well so donât hesitate to do it.

Hey! I used some of your code and it seemed to work like a charm.
={âRecentâ;ARRAYFORMULA(IF(E2:E=TODAY(),âReviews todayâ,IF(E2:E=TODAY()-1,âReviews yesterdayâ,"")))}

This give me the last 2 days based on a date in another field. For some reason it stopped working though. Any idea whats up? Maybe I broke it somehow.

What is it returning now?

Currently nothing. I am not sure what happened because it worked at some point.

Share with me the sheet, I will take a look to see what happens