how to do or improve a "hard coded forecast"

I am looking for opinions on how to do or improve a “hard coded forecast” (I dont really know what to call this, but I’ll explain).
I have say, a monthly sales figure, or a daily sales figure or whatever (the exact content doesnt matter). In Excel, using pivots and formulae and stuff, we’ve got a “forecast” for each value on the x-axis in a lookup table. This looks something like this:
image

Now I want to use this in Looker to create a “forecast” line to show the actuals as a bar, and the “forecast” as a line. The underlying table is much more granular - 1 row per account, aggregated to the day/month.
The end result is something like this:

The red line, tracks the actuals up to a point, where it then follows this “forecast”.
Currently, I have this as one HUGE nested if statement with hard coded values in it - which means it is computationally heavy and needs to be manually updated every month from the excel file.
The if statement looks like this:
image

image
Before you ask, the resulting values are not linear, hence they need to be put in for every day.

Does anyone have a better suggestion of how to do this? or achieve the same effect?
My thoughts are to create an aggregated table in our datawarehouse, with this lookup table feeding in via Google Sheets, and then joining and calculating it there. But that means that I have a separate little table for this tile, which means more maintenance, and it is not explorable.
happy to answer questions if you have - I probably didn’t do a very good job at explaining it.

0 2 403
2 REPLIES 2

What kind of Database / Data Warehouse do you use? I think you need to think about consuming the Excel / Google Sheet file programatically, in order to move it to your data source. Otherwise, you will be left with these hacks and at one point they’ll be a nightmare, though judging by the size of this if statement, they’re already are.

A simpler hack could be to use CSV to SQL tool that creates SQL for you and you just copy and paste it to a view. You can either use this: https://csv-sql.web.app/ or use formulas in Excel to build the SQL yourself.

Here is an article from Looker Help:

Hi

Thnx for your reply - yes, I ended up putting it in our data warehouse this morning by means up loading a Google Sheets into our data warehouse, and then summarising/aggregating it into a separate table, then joining on my VLOOKUP data.

Top Labels in this Space
Top Solution Authors