Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
sandp707
Contributor III
Contributor III

Create a for loop to sort the months and get the middle/median value (URGENT)

Hello everyone,

Could someone please help with a script as this is very urgent.

I want to create a for loop to sort on basis of 3 Months and get the middle values from measure.

Data granularity - Under market there are products, and we can same product name under multiple markets

sandp707_1-1657040410432.png

Column E - 

This is the sample data screenshot, here I want to create a for loop with a counter which will sort the Count (column D) for every 3 months (column A) and bring the middle/median of the Count column and place it in Column E (highlighted).

Column F - 

This column is difference between the median derived from above for loop and the current month 

Column G - 

This is again the median from Column F (difference) and this should also be from a for loop.

I want this using for loop as because the number of months to derive the median can be 3,4,5... as per the client request.

Thanks,

Sandeep

 

 

 

Labels (2)
3 Replies
MarcoWedel

are you looking for a script solution or a chart expression?

sandp707
Contributor III
Contributor III
Author

Hello Marco,

I am trying to achieve from script. If you can help with chart expressions is also great. 

Thank you

sandp707
Contributor III
Contributor III
Author

Hello everyone,

I need to see the median of the previous 3 records. 

BE884A66-D7C2-4CBD-854E-BDBA12E46F37.jpeg

 Where, prev 3dlvry = median of previous 3 records 

actual deviation = difference between current count and the median of prev 3dlvry

typical deviation = total median of actual deviation