Combine Data But Need to Create New Column Name as new current month

Hello Guys,

I am almost done however I can’t achieve the final output I want.

Here’s the raw data I have: Report January, Report February and Report March

Report February.xlsx (16.5 KB)
Report January.xlsx (16.4 KB)
Report March.xlsx (16.8 KB)

Here’s the final output I want: Final Output for 3months ( I only need the ‘Account’ and ‘Amount’ in raw data however need to change the Amount column name into its Last day of the month.

Final Output for 3months.xlsx (17.4 KB)

In short, every month it will be added a new data for the current month. So once I have added January, next month, I will add February then March so on until December then repeat to January again for new year.

Hope you can help me guys. Thank you so much as this is really hard for me to figure out.

Note: The account is being added or reduced every month though I still want to retain the old account and only add new account that will be added to preserve everything.

cc: Everyone and @rfeigel @takbb

Hi @trafalgarlaw

See this wf Combine data.knwf (130.0 KB).

There is some inconsistency in your data. The data in the Closing Balance (Report Currency) columns are not always numbers …and have different names.
Closing Balance (Report Currency) #27
Closing Balance (Report Currency) #29

Therefore I added a Column Aggregator to be sure you end up with only one column containing Closing Balance information.

If you have all input files in the same folder than you can make use of the option in the Excel Reader, to read in all your monthly files at once. So you don’t need to modify flow (remove the Concatenate node, and connect the Excel Reader directly to the Column Aggregator)

Just add new input files to the folder.

afbeelding

See if this works for you.

gr. Hans

4 Likes

Hello @HansS,

I am all good thanks for your help.

I have a question again:

This is the data before I groupby:
Consolidated data with all months.xlsx (58.7 KB)

Output:
Output with all months.xlsx (26.2 KB)

My question is, I am getting the right data already however, in GroupBy node - what if the 2024 data (highlighted in green box) will be replaced to a 2025 data for example the 2024-04-30 to 2025-04-30 hence it needs to be recaptured again or configured manually. It will also happen for 2025 when 2026 data kicks in.

Is there a way it will be automatic that data or columns in the manual aggregation will be added? Or Is there a another approach to do it? Thank you!

cc: @everyone @HansS @rfeigel @takbb

Hi @trafalgarlaw

See this wf Combine data_v2.knwf (132.7 KB)

This wf select the 5 columns with the most recent dates. So when your excel is updated with a new column name (recent date), the GroupBy is performed with those new set of column names.

gr. Hans

2 Likes

Hello @HansS , when I download the workflow it looks like the old workflow you sent.

Hi @trafalgarlaw

This one: Combine data_v3.knwf (194.6 KB)
afbeelding
gr. Hans

1 Like

Hello @HansS - sorry for the confusion. What I meant was, For all these columns in Groupby that I’ve set is all good with the data I have. However, if I will have a new data, the 2024-04-30 will be replaced as 2025-04-30 hence the Groupby node will not read the 2025-04-30 in this manual aggregation because it is a new column.

So my question is, how can I ensure even that I have new data with new months, it will still be captured.

As checked here’s the output of your workflow:

This is still the output I want:

Output with all months.xlsx (26.2 KB)

Hi,

you can use the “Pattern Based Aggregation” tab or “Type Based Aggregation” tab.
In the first you can define a pattern to select all columns like “--*”
In the latter one you can select the “double type” columns.

1 Like

Thank you @ActionAndi and @HansS !! Got the results I want.

I will just test it more with other data and close this once all good. Again, thank you both! You are the best!

1 Like

Hello @ActionAndi, @HansS or @everyone,

Sorry last question when I test the Pivoting Node,

Is there a way that it will be sort like this without manually configuring it?

This is the output of the loop before I put it in Pivoting Node. The column header (Column C in this file) is in order the way I want it to be sorted:

Sample loop output.xlsx (66.7 KB)

How about this?

Use “Extract Table Spec” to extract the column names, Sort the Names as you like and use “Reference Column Resorter” to resort your table:

PS: I created an empty table for displaying purposes. Thats why theres a " ! " in the traffic light

1 Like

Again, thank you so much for all the help @HansS and @ActionAndi !! All the best!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.