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

% of Total Per Week

tr3nd
5 - Atom

Hi all,

 

I have a data set in which I am trying to calc the % of total per week, and can't for the life of me figure it out.  I need the % of a field that coincides to the week total for the week it belongs to.  Below is an example of the data I have:

 

WeekDayEx1Ex2Ex3
1Mon102030
1Tue102030
1Wed102030
1Thu102030
1Fri102030
1Sat102030
1Sun102030
2Mon102030
2Tue102030
2Wed102030
2Thu102030
2Fri102030
2Sat102030
2Sun102030

 

 

I am trying to get an output like this:

 

WeekDayEx1Ex2Ex3
1Mon2%5%7%
1Tue2%5%7%
1Wed2%5%7%
1Thu2%5%7%
1Fri2%5%7%
1Sat2%5%7%
1Sun2%5%7%
2Mon2%5%7%
2Tue2%5%7%
2Wed2%5%7%
2Thu2%5%7%
2Fri2%5%7%
2Sat2%5%7%
2Sun2%5%7%

 

Anyone have any suggestions?

 

Thanks!

6 REPLIES 6
BrandonB
Alteryx
Alteryx

The first step is to summarize the data. Group by Week and Sum the field. Then join the data back to the original data on the week field. Then you use a formula tool to divide the value into the sum. 

BrandonB
Alteryx
Alteryx

percent of week.png

afv2688
16 - Nebula
16 - Nebula

Hello @tr3nd ,

 

Hope this helps

 

Untitled.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Regards

RolandSchubert
16 - Nebula
16 - Nebula

Hi @tr3nd ,

 

first step is to calculate the "sum by week" (use Summarize tool and group by week). Then you join the sum values to the original using the Join tool. To calculate the percentages, a Formula tool can be use. Last step is "formatting" as percentages, this needs conversion to string datatype and adding a "%" sign. I've attached a sample workflow.

 

Corrected calculation (percentages of total all columns, not single column)

 

Best,

 

Roland

afv2688
16 - Nebula
16 - Nebula

Or as your output:

 

 

tr3nd
5 - Atom

Awesome, this worked perfectly!

Labels