Alteryx Designer Desktop Discussions

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

COUNTIFS

timol
8 - Asteroid

Dear all

 

I have the following data structure

Company Year1Year2
A20182015
A20182015
A20182016
A20182016
A20182016
A20182018
A20182018
A20182018
A2018

2018

 

Now I want Alteryx to give out a count for each year 2015-2020

But it should only count of Year 2 os lower of equal to Year1

So that would be the output

CompanyYearCount
A20150
A20160
A20170
A2018

9

 

Can anyone help me doing this in Alteryx?

 

13 REPLIES 13
afv2688
16 - Nebula
16 - Nebula

Hello @timol ,

 

would this workf for you?

 

Untitled.png

 

Regards

timol
8 - Asteroid

@afv2688 Thank you so much!!!

 

 

Do you also have such a solution for the following data structure:

 

Company Year1Year2
A20182015
A20182015
A20182016
A20182016
A20182016
A20182018
A20182018
A20182018
A20182018
A20172017
A2017

2018

afv2688
16 - Nebula
16 - Nebula

Hello @timol ,

 

How about this?

 

Untitled.png

 

Regards

timol
8 - Asteroid

Thank you @afv2688

 

 

I tired to implement the workflow in my case but it does not work (I am not capable of implementing...)

 

One addition to the previous table

I always want to show the timespan from 2013-2018 except if the founding of the company is later than 2013 (e.g. 2015). Then I want to show 2015-2018

 

 

Company Year1Year2Founding
A201820152013
A201820152013
A201820162013
A201820162013
A201820162013
A201820182013
A201820182013
A201820182013
A201820182013
A201720172013
A201720182013
A201920152013
A201920172013
A201920192013
A201920122013
A201920112013
A201920072013
B201620112015
B201620112015
B201620152015
B20162015

2015

 

Do you have an idea how to do that?

 

OllieClarke
15 - Aurora
15 - Aurora

Hey @timol very similar to @afv2688's previous solutions, but this should do what you're after:

OllieClarke_0-1617033609521.png

 

afv2688
16 - Nebula
16 - Nebula

Hello @timol ,

 

Adapted the solution to your needs.

 

Let me know if you need anything else,

 

Regards

timol
8 - Asteroid

Thank you

 

But the value for company A in 2018 should be 11 right?

timol
8 - Asteroid

Thank you!

 

But for company A the timespan should start with the founding year 2013 right?

afv2688
16 - Nebula
16 - Nebula

Hello @timol ,

 

Here you go. Based on your perrequisites (year2 <= year1 it shouldn't)

 

Another thing would be if we have to add the 2017 data to the 2018, calculations would need then to be different (and even then it would be 10).

 

If that is the case, I also added another workflow.

 

Regards

Labels