Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9071

Re: Not considering '0' value while calculating median

$
0
0

hi Brian,

 

to do this in your cross-tab,

1) right click on your cross-tab summary where you want to display the median and choose Format

2) in the Display String dialogue, change the syntax to basic

3) paste the following in

 

whileprintingrecords

 

 

local snz as number

snz =  currentfieldvalue

 

 

global avnz() As number

global inz as number

global menz as number

 

 

if snz <> 0 then

inz = inz + 1

redim preserve avnz(inz)

avnz(inz) = snz

 

 

dim lonz, linz, tvnz

 

 

for lonz = 1 to inz

   for linz = 1 to inz-1

       if avnz(linz) > avnz(linz+1) then

          tvnz = avnz(linz)

          avnz(linz) = avnz(linz+1)

          avnz(linz+1) = tvnz

       end if

   next linz

next lonz

 

 

dim imnz as number

imnz = ceiling(inz/2)

end if

 

 

if remainder(inz,2) <> 0 _

then menz = avnz(imnz) _

else if imnz >= 1 then menz = (avnz(imnz) + avnz(imnz + 1))/2

 

 

formula = totext(currentfieldvalue)

 

4) now in the Total below right click and choose format

5) in the Display string for that total, change the syntax to basic

6) put in the following

 

whileprintingrecords

global menz as number

formula = totext(menz)

 

 

cheers,

jamie


Viewing all articles
Browse latest Browse all 9071

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>