Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nlaughton
Contributor II
Contributor II

Calculate Median

Hello, 

 

i've tried to read other threads/questions  and cannot quite get it correct. I'm pretty new to Qlik,forgive me if my terms are imprecise. my  I'm trying to calculate a median for an expression that contains a sum. 

a sample of my underlying data looks like this. 

End DatePrintNameUnitCostNumberRXQTY
4/25/2019ACETAMINOPHEN 325MG TAB0.00535500
4/25/2019ALLOPURINOL 300MG TAB0.0628260
4/25/2019ALLOPURINOL 300MG TAB0.0787130
4/25/2019ALLOPURINOL 100MG TAB0.042390
4/25/2019AMITRIPTYLINE HCL 50MG TAB0.1799130
5/27/2019BUPROPION HCL 150MG 12HR SA TAB0.0695390
5/27/2019BENZOYL PEROXIDE 5% (WATER BASED) GEL0.1155160
5/27/2019BUPROPION HCL 150MG 24HR SA TAB0.216390
5/27/2019BUPROPION HCL 300MG 24HR SA TAB0.2247260
5/27/2019CALCITRIOL 0.25MCG CAP0.3164115
5/27/2019CAPSAICIN 0.025% CREAM0.035160
5/27/2019CLINDAMYCIN PHOSPHATE 1% TOP GEL1.1303130
5/27/2019CLONIDINE HCL 0.1MG TAB0.0139160
6/23/2019FLUOXETINE HCL 20MG CAP0.01827330
6/23/2019FOLIC ACID 1MG TAB0.05585150
6/23/2019FUROSEMIDE 20MG TAB0.004160
6/23/2019FUROSEMIDE 40MG TAB0.02693120
6/23/2019FUROSEMIDE 80MG TAB0.074260
6/23/2019FLUOXETINE HCL 10MG CAP0.0202130
6/23/2019FLUTICASONE PROP 50MCG 120D NASAL INHL6.1211
6/23/2019FLUTICASONE PROP 50MCG 120D NASAL INHL2.961010
6/23/2019FENOFIBRATE 54MG TAB0.2009115

 

i have the data aggregated by ENDDATE,  again here is a sample 

End Datesum(NumberRX)Median
4/25/201980913?
5/27/201981040?
6/23/201978227?
7/27/201991562?

What i am looking for a is an expression to find the median of the "sum(NumberRX)" 

 

Thanks for  everyone's help.

 
 

 

10 Replies
nlaughton
Contributor II
Contributor II
Author

Thank you for bearing with me with my foibles and imprecise explanations, the script works great!