Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

how to define dynamic range when I export the query data to Excel template file

mingjueca
6 - Meteoroid

I have one question about setting dynamic range when I export the query data to Excel template file. 

 

Here is background : 

 

I create weekly sale by Rep report by pulling query from Oracle and export the result to Excel template file, then rename the template file with week number. 

 

For example : current week = 08, the final weekly report only shows sales data from wk1-wk8.  

 

In the template file, , the header of the tab "data"f has 52 columns for W1-W52. Also the header start from A3. 

 

Each week the query has one more week data and the number of sales Rep changes too.  

 

Currently I use the fixed range for example : A4-BB4000 which I choose max week and max sales Rep) instead of dynamic range. 

 

But I don't how to delete the extra columns from wk9-wk52. 

 

In Excel VBA, it is easy to remove extra week number columns by adding current week number.

 

Is there a way to achieve this in Alteryx ?  Thanks all

 

Attached is the excel file which the first sheet is final report should look like and the second sheet is output I used fixed range.

  

11 REPLIES 11
Qiu
21 - Polaris
21 - Polaris

@mingjueca 
Can you output the  range A3-BB4000 with the header information?

binuacs
21 - Polaris

@mingjueca based on my under standing you need to dynamically remove the columns which are not in use for each run. Attaching a sample

 

binuacs_0-1646032236240.png

 

flying008
15 - Aurora

@mingjueca 

 

Hi, pls see the gif.

 

1- Today is 2022-02-28, So we get the Current Week Number is 10th.

2- Use the Dynamic Selcet tool, Expression like: [Name]="Sale No" || [Name]="Region" || [WeekName] <= CurrentWeek

3- So you can get the max week column like dynamic range for everyday.

录制_2022_02_28_15_21_43_376.gif

atcodedog05
22 - Nova
22 - Nova

Hi @flying008 

 

Nice way of showing how to do a specific action. Can you share with us how you created this I would be really helpful 🙂

 

Thank you for the knowledge share 🙂

Qiu
21 - Polaris
21 - Polaris

@flying008 
nice one.
Can I ask what tool you are using to make the Gif? 😁

atcodedog05
22 - Nova
22 - Nova

Join the club @Qiu 😀

atcodedog05
22 - Nova
22 - Nova

Hi @mingjueca 

 

I think the above post has provided you with the solution for your use-case. Let me just summarize it end to end.

 

Let's say this is your template sheet with all weeks. And now you want this sheet to have weeks till W8 and reset removed.

atcodedog05_0-1646034425069.png

 

Workflow: You can use the data cleanse tool remove null columns to remove the extra columns. @binuacs workflow is doing a similar thing.

atcodedog05_1-1646034716349.png

 

Writing to file: as @Qiu mentioned you can write from A3- with the headers this way only the required table will be outputted.

atcodedog05_2-1646034815795.png

 

Output:

atcodedog05_3-1646034925095.png

 

Hope this helps : )

flying008
15 - Aurora

Hi, @Qiu & @atcodedog05 ,

@Qiu My dear friends, maybe you can try to made gif by oCam software.😁

@atcodedog05, Dear, the Cleansing resolved the case is a good idea.👍

 

 

Qiu
21 - Polaris
21 - Polaris

@flying008 
Thank you for the information.
let me give a try!

Labels
Top Solution Authors