Summary: Based on a variable (in this case month); The columns i include in the select and rename need to change.
The setup:
Select behavior:
-------
In an ideal setup, i would find The Month from the DATASET (will be the same for whole dataset), Find the corresponding Forecast from the CONTROL_TABLE, and then only select the corresponding forecast based on the result of the mapping of Month to Forecast from the CONTROL_TABLE;
I can -
Isolate the month from the DATASET, Return the corresponding Forecast from the CONTROL_TABLE;
The ask -
The part I am looking to gain assistance on is the selecting columns based on the mapping.
Avenues Explored:
I Can do a complicated if tree that determines month and takes a path based on month, this works but is cumbersome
Some type of CASE statement would be better than an If tree but I can seem to find one
Dynamic Select appears that it may be the right way to go, but I cant quite sort it out
Thoughts are greatly appreciated!
This month is the current month or you will be able to run 2-3 months in one execution?
To answer your previous post; Each run would only have a single Month.
Your solution is workable, I'll use it as a starting point. I've not stress tested this solution, but I have a feeling it will bog down a bit, >1mill rows in dataset x 6 forecasts makes for a lot of cross tab transformation.
Apologies for the late response. Many moving projects over here just now circling back. Let me evaluate this solution. Thank you in advance and i'll be Sure to mark it if I can apply this!
The columns on the input data are called things like "Forecast39", "Forecast66", and "Forecast93". All of these appear in the data, but for any given month, i only need one of them, and need to call it "FCST";
The part i'm finding hard is saying:
Based on column "Month" i can identify its currently 'May' and in 'May' i need to use "Forecast66" so rename "Forecast66" to "FCST" and dont rename/select the others. But in October, i need to do the same thing this time with "Forecast93" and rename it "FCST"