Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

combine values in new table and append to original

Mikis
8 - Asteroid

Hello everyone,

 

Sorry for the cryptic subject, but I couldn't come up with something more descriptive.

I have a macro called 'addTotals' (cf attachment).

 

The input is a dataset (variable number of fields), the fields in that dataset for which we want totals (variable number of records) and the name that the total should have.

 

What it does is, for a number of specified columns, append the dataset again but with value 'total'.

Let's say my data is the following:

fieldAfieldBfieldCvalue
ACE0,15
BDF0,25

 

and let's say I need totals for 'fieldA' and 'fieldB', then the macro will create the following:

fieldAfieldBfieldCvalue
TotalCE0,15
TotalDF0,25
ATotalE0,15
BTotalF0,25

 

This works fine, but I also need the combined 'Totals'.

So the part that I'm missing is

fieldAfieldBfieldCvalue
TotalCE0,15
TotalDF0,25
ATotalE0,15
BTotalF0,25
TotalTotalE0,15
TotalTotalF0,25

 

Does anyone know how to add this in a flexible way?

I know that the field will have a certain name (in this case 'Total') because it's one of the 3 macro inputs.

The number of fields for which I want totals is not fixed, nor is the total number of input fields.

 

Thanks a bunch,

Mikis

 

6 REPLIES 6
MarqueeCrew
20 - Arcturus
20 - Arcturus

@Mikis,

 

Have you tried using the "Add Totals" macro from the CReW macros?

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Mikis
8 - Asteroid

Hello MarqueeCrew,

 

Thanks for your suggestion.

 

I did look into this macro, but unless i'm mistaken it's not what I'm looking for.

The totals macro (correct me when wrong) adds a calculated row and/or column 'total'.

I don't want calculated rows, I want my original dataset but then appended with that same dataset where some fields have their values replaced by a 'total' (so it would double if there's one field to total, and more than tripple when there are 2 fields to total).

 

Perhaps the following example makes it more tangible.

Let's say I have a field 'physician_ID'.

A physician can be (just as an example) be specialized in cardiology or oncology, but I also want to make calculations ignoring this specific dimension ('overall specialty'). He can be active in France or Italy, but I also want to make calculations ignoring that dimension ('overall region')

 

Since the calculations will happen later on in the process, I don't want an aggregated field just yet. First I want to list all options, which is what I'm trying to do here.

  

Regards,

Mikis

ponraj
13 - Pulsar

Here is the dynamic workflow you are looking for... 

Sample DataSample DatafieldToTotalfieldToTotalWorkflowWorkflowResultsResults

 

Mikis
8 - Asteroid

@ponraj

Could you please attach again? It says there's an error opening the file.

Data at the root level is invalid. Line 1, position 1.

 

From the looks of it, it seems that it's indeed what I need

ponraj
13 - Pulsar

Here you go

Mikis
8 - Asteroid

Brilliant stuff, thanks a lot!

Labels