Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Decoding status based on a measure and dimension

jayviz
7 - Meteor

I have this dataset I get after couple of other transformations. What I am trying to do is to display a status against each company based on 'Unit Sold' for a particular week num and year

 

e.g. Microsoft and Amazon did not sell anything for 2020 Week 2 - so status column should display 'Nothing Sold' against them by adding those 2 rows for 2020 Week 2 . Similarly for 2019 week 4 , Amazon did not sell anything - so it should add another row to display the 'Nothing sold' status for that.

 

CompanyWeek NumYearUnit SoldStatus
Google1202050 
Microsoft12020100 
Apple1202015 
Amazon1202020 
Google220205 
Apple2202010 
Google4201980 
Microsoft4201950 
Apple4201960 
6 REPLIES 6
vizAlter
12 - Quasar

Hi @jayviz — Welcome to the community!

It's good to attach sample/dummy data to know more about your Input file and desired output file, both?

ConnorK
Alteryx
Alteryx

Hi @jayviz ,

 

I have attached a documented solution that should help with this. The key steps are first checking to see if all weeks are listed regardless of company, and secondly using the cross-tab and transpose functions to build the required week rows for each company.

 

I hope this helps!

 

Best,

Connor Kelleher
Senior Sales Engineer
Alteryx
jayviz
7 - Meteor

@ConnorK - I tried what you sent. Slight issue there is If I add week '6' to 2019 and lets say 2020 only have weeks until week 4, it will add week 6 to 2020 regardless. That will cause issues.

 

so our input will become 

 

jayviz_0-1600793317977.png

 

 

Output will be 

 

jayviz_1-1600793376283.png

 

which obviously adding unwanted week 6 to 2020 as well.

jayviz
7 - Meteor

@vizAlter  Here is what I am trying to achieve

 

Input

 

CompanyWeek NumYearUnit Sold
Google1202050
Microsoft12020100
Apple1202015
Amazon1202020
Google220205
Apple2202010
Google4201980
Microsoft4201950
Apple4201960

 

Desired Output

 

CompanyWeek NumYearUnit SoldStatus
Google1202050 
Microsoft12020100 
Apple1202015 
Amazon1202020 
Google220205 
Apple2202010 
Microsoft22020 Nothing Sold
Amazon22020 Nothing Sold
Google4201980 
Microsoft4201950 
Apple4201960 
Amazon42019 Nothing Sold
echuong1
Alteryx Alumni (Retired)

Try the attached:

 

You can avoid including additional weeks that didn't have data by creating combinations of the weeks and years with data via a summarize tool.

 

echuong1_0-1600798783214.png

 

 

jayviz
7 - Meteor

@echong1 this is Perfect ! Thank you !!

Labels