Alteryx Designer Desktop Discussions

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

How to count the number of positive value of a row?

GraceK_dup_114
7 - Meteor

Hi everyone,

 

I have a table with numbers and I would like to count the number of positive value per row. Do you have an idea of how to do that?

 

Thanks in advance!

 

Grace

5 REPLIES 5
afv2688
16 - Nebula
16 - Nebula

You could use the multi row formula, add a variable (I named mine [Count]), and add the current formula:

 

IF [Field1]>=0 Then [Row-1:Count]+1 ELSE [Row-1:Count]+0 ENDIF

 

this would give you at the end of your file the amount of positive values.

 

cheers

GraceK_dup_114
7 - Meteor

Hi, 

 

What should I replace "Field1" by excatly?

If I copy paste the code line as it is, Alteryx tells me that "Field1" is unknown. 

 

BR,

 

Grace

afv2688
16 - Nebula
16 - Nebula

Hello @GraceK_dup_114 ,

 

On this workflow you will find both methods, count per row and per column, since I really don't know which you were really looking for.

 

On the join, where I select [Field3], you have to select the last colum with numbers to be included.

 

PS: [Field1] is for me the coulm which has all the numbers to be counted. (Since I first thought it was a count per Column and not per Row)

 

Cheers.

afv2688
16 - Nebula
16 - Nebula

Also if you want me adapt it for you I would need at least the table headings so that there is no modification needed by your side.

 

Cheers

Thableaus
17 - Castor
17 - Castor

Hi @GraceK_dup_114 

 

It could be very simple. See flow attached

Count_Positive.PNG

 

- Add a Record ID

- Transpose Fields grouping by Record ID

- Add a Formula Tool to flag the positive numbers (IF [[Value] > 0 then 1 else 0)

- Summarize to Count the number of positive flags

- Join it back to your dataset by Record ID

 

Cheers,

Labels