Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Group by and total - Struggling for 4 days

Kallis
8 - Asteroid

Hello Friends

 

I am struggling with a requirement for the past 4 days.I have given a table below. 

The requirement is that this must be GROUPED BY Cost Centre. 

One Cost Centre should have one line which means that the columns from Value till Total Billing must be summed up. The problem is that some of these columns, Billing till Total Billing are STRINGS. I have replicated the Excel formula behind these columns. 

 

Please see the attached screenshot from the Alteryx Output window.

 

If I convert these columns into double or int so that I can use the Summarise tool to Group By, the formula is gone and the columns become empty. I tried the Formula tool to convert these columns into a number but the result was the same. 

I hope I have explained somewhat clearly. Kindly help.

 

Formula.JPG

 

RecordIDCost CentreNameStatusTeamRevenue CCValueAdjustmentTrue UpBillingMarkupTotal Billing
2CC1ADelivery IncludedCarenRevenue CC1-1012.1300-1012.13-151.8195-1163.9495
3CC1ADelivery IncludedCarenRevenue CC11012.13001012.13151.81951163.9495
4CC1ADelivery IncludedCarenRevenue CC11236.44001236.44185.4661421.906
5CC1BSite LegalIncludedMalfoyRevenue CC22927830029278343917.45336700.45
6CC1BSite LegalIncludedMalfoyRevenue CC2-733503.2100-733503.21-110025.4815-843528.6915
7CC1BSite LegalIncludedMalfoyRevenue CC2879232.2100879232.21131884.83151011117.042
8CC1BSite LegalIncludedMalfoyRevenue CC223820.10023820.13573.01527393.115
9CC1BSite LegalIncludedMalfoyRevenue CC27443.78007443.781116.5678560.347
10CC1CSite LegalIncludedRonRevenue CC311165.670011165.671674.850512840.5205
11CC1CSite LegalIncludedRonRevenue CC32709940027099440649.1311643.1
12CC1CSite LegalIncludedRonRevenue CC31171130011711317566.95134679.95
13CC1CSite LegalIncludedRonRevenue CC372.090072.0910.813582.9035
14CC1CSite LegalIncludedRonRevenue CC3245.9300245.9336.8895282.8195
15CC1DSite LegalIncludedHarryRevenue CC411263.820011263.821689.57312953.393
16CC1DSite LegalIncludedHarryRevenue CC421399.290021399.293209.893524609.1835
17CC1DSite LegalIncludedHarryRevenue CC43388400338845082.638966.6
18CC1DSite LegalIncludedHarryRevenue CC41463.92001463.92219.5881683.508
19 REPLIES 19
apathetichell
19 - Altair

 

As I read this - you want to keep the values as formulas--- AND get the values out of the formulas for other parts of the workflow.

my recommendation would be to bring in the file twice via batch macro - one time to get the formulas - one time to get the numbers. I'd add a recordid in my batch macro so I knew which row corresponded to which. I'd probably create a tag via however I was changing my input data - and then use a filter tool to pass it to the correct output. I'd configure my interface designer/macro to union by name. In my main workflow I'd join my two outputs by record id. I can do this after or before manipulating my numeric side to group by/whatever.

 

You can try posting your workflow/real data/a .yxzp.

ChrisTX
16 - Nebula
16 - Nebula

Do you just need to change some of the data types from String to Numeric, then summarize by Cost Centre?

 

See attached workflow.  I used the Select tool to change two fields to a String, then used a Multi-Field Formula tool to convert string fields to numeric.

 

Screenshot 2024-09-12 142117.png

 

Chris

Kallis
8 - Asteroid

Hi @ChrisTX 

Perhaps, I wasn't clear with the requirement.

 

The formula in the Billing, Markup & Total Billing must be retained because the changes in the columns, Value, Adjustment & True UP will affect the Billing, Markup & Total Billing columns. 

I want to Group by Cost Centre and also summarise the numbers.

Kallis
8 - Asteroid

Hi @apathetichell 

 

I have never used macro before. Is there any other method?

 

Regards

Bobji

Qiu
21 - Polaris
21 - Polaris

@Kallis 
I dont quite get this part "The problem is that some of these columns, Billing till Total Billing are STRINGS. I have replicated the Excel formula behind these columns. "
If some value turns to empty, it means that it contains some non-numeric characters.
Anyway, I made a simple sample flow to calculate the columns  "Billing", "Markup" & "Total Billing", then get the sum up for each cost center.

0913-Bobjik.png 

apathetichell
19 - Altair

@Qiu - I think you parsed the request correctly - I read it as being much more complicated (ie keeping the raw formulas from excel for lineage - and manipulaing the values).

Kallis
8 - Asteroid

Hi @Qiu 

Thanks for your response but unfortunately, this wasn't the solution I was looking for. 

The columns, Adjustment & True Up must be available in the final excel for the user to add any value. This must be reflected in the Billing, Total Billing and the Markup columns.

Qiu
21 - Polaris
21 - Polaris

@Kallis 
Can you share some sample input and desired output so we can take a closer look?

Only wording it is difficult to replicate the issue.

Kallis
8 - Asteroid

Hi @Qiu 

 

The input is as given in the beginning of this thread.

This is the expected output.

One line per cost centre with the columns Value, Billing, Markup, Total Billing summed up.

For example, 3 rows with Cost Centre as CC1A is summed up in the first row. Likewise, 5 rows for CC1B in the second row, so on and so forth.

 

Hopefully, I have made it clear.

Also, this is the formula

Billing - =sum(Value + Adjustment + True UP)

Markup - =Billing * 15%

Total Billing - =sum(Billing + Markup)

 

These formulas must stay so that when the user adds any value to Adjustment or True Up, it will be reflected in the above columns

 

 

Cost CentreNameStatusTeamRevenue CCValueAdjustmentTrue UpBillingMarkupTotal Billing
CC1ADelivery IncludedCarenRevenue CC1-1012.13001236.44185.4661421.906
CC1BSite LegalIncludedMalfoyRevenue CC24697775.8800469775.8870466.382540242.26
CC1CSite LegalIncludedRonRevenue CC3399590.6900399590.6959938.604459529.29
CC1DSite LegalIncludedHarryRevenue CC468011.230068011.0310201.65578212.685
Labels