Alteryx Designer Desktop Discussions

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

Count with conditions

timol
8 - Asteroid

Dear all

 

I have the following data structure

 

IDCreatedExperience
120172015
120172016
120172017
120172018
120172019
120172020
220152015
220152016
220152017
220152018
220152019
220152020

 

 

Now I would like to count the experience column but only if the year if <= Created

 

see an example output

 

IDYearCount
120150
120160
120173
120184
120195
120206
220151
220162
220173
220184
220195
22020

6

 

Is it right to use the Summarize tool with two group by options?

4 REPLIES 4
AngelosPachis
16 - Nebula

Hi @timol ,

 

You can try counting the years first for each ID and then with a formula tool, you can set those that don't meet your condition to 0

 

AngelosPachis_0-1616955942349.png

 

Hope that helps, let me know if that works for you.

 

Cheers,

 

Angelos

AbhilashR
15 - Aurora
15 - Aurora

Hi @timol, in addition to the multi-row formula approach suggested by AngelosPachis, you could use the TileTool or RunningTotal tool to compute the count and then use the formula tool to reflect the logic of Created vs Experience. The Summarize tool might not work in your case given you are looking to do some form of running total (or a rowID within a given ID).

 

   

timol
8 - Asteroid

Thanks to both of you!

 

It works

But I think right now it only works if I have one value for each year right?

I want to print out a value for every year in a given time span e.g. 2015-2020

AngelosPachis
16 - Nebula

@timol  if you 've found that you are missing some years and you want to generate all years between a certain range for each ID, you can use a generate rows tool to create that list of years for each ID.

 

Then it's pretty much the same process.

 

AngelosPachis_0-1616999993600.png

 

Hope that helps, let me know if that worked for you.

 

Cheers,

 

Angelos

Labels