cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Thomas1
Level V

How to calculate zero portion in %

What is the best way to create on formula column, which shows the portion in percent of values = 0 (Zero portion)?

In case the value column is empty, no portion value should be display in the formula column.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to calculate zero portion in %

I think this might do what you want

If( Is Missing( :Value ) == 0,
	Col Sum( If( :Value == 0, 1, :Value > 0, 0, . ), :SubGroup ) / Col Number( :Value, :SubGroup ),
)
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How to calculate zero portion in %

I am not exactly sure what you are looking for, but if you want to know the portion of the data table that contain zeros, I have included a couple of formulas that will do that

zeroportion.GIF

Jim
Thomas1
Level V

Re: How to calculate zero portion in %

Thanks for your fast response.

I'm looking for formula which shows the portion of the vaule 0 only. Additional if the cell of the source is empty, the cell for the corresponding portion value should be empty.

 

I’m able to achieve this with the formula

 

 

If( Is Missing( :Value ) == 0,
            Col Sum( If( :Value == 0, 1, :Value > 0, 0, . ) ) / Col Number( :Value ),
            .
)

 

 Despite getting the right result, I am wondering whether there is a better way to solve this. In particular with regards to apply this formula to sub groups.

txnelson
Super User

Re: How to calculate zero portion in %

I think this might do what you want

If( Is Missing( :Value ) == 0,
	Col Sum( If( :Value == 0, 1, :Value > 0, 0, . ), :SubGroup ) / Col Number( :Value, :SubGroup ),
)
Jim
Thomas1
Level V

Re: How to calculate zero portion in %

Thanks again for yor fast reply.