Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
KL1
Contributor III
Contributor III

How to sum top 5 items by month in load script

Hello Experts,

I have a dataset where defects are recorded as DefectNo, Defect Date, Costs Incurred, rootcause. Rootcause is not unique here, there could be 5 defects due to a single rootcause.

i am trying to make a chart for sum of coasts incurred due to top5 rootcauses by month.

Is there a way to achieve this in qliksense  load script (please)- I understand Groupby groups Rootcauses, but i want to group by each month and then sum the top5.

I would want to have Month name on the x-axis, with bars for each month representing the sum of costs incurred only for the top 5 root causes please.

A model of the data is as below.

Defect NoDefect DateCosts IncurredRoot cause
115/05/2021 $               59.00Cause1
215/05/2021 $               98.00Cause2
318/05/2021 $               76.00Cause1
418/05/2021 $               76.00Cause4
519/05/2021 $               23.00Cause5
619/05/2021 $               43.00Cause6
719/05/2021 $               34.00Cause3
819/05/2021 $               76.00Cause7
919/05/2021 $               45.00Cause8
1020/05/2021 $               50.00Cause1
1120/05/2021 $               60.00Cause2
1220/05/2021 $               23.00Cause1
1320/05/2021 $               32.00Cause4
1420/05/2021 $             345.00Cause5
1518/05/2021 $          2,341.00Cause6
1618/05/2021 $          1,234.00Cause3
1718/05/2021 $          1,111.00Cause7
1801/06/2021 $             567.00Cause8
1902/06/2021 $               34.00Cause3
2002/06/2021 $               76.00Cause7
2102/06/2021 $               45.00Cause8
2202/06/2021 $               50.00Cause1
2302/06/2021 $               60.00Cause2
2403/06/2021 $               23.00Cause1
2503/06/2021 $               32.00Cause4
2603/06/2021 $             345.00Cause5
2704/06/2021 $          2,341.00Cause6
2804/06/2021 $          1,234.00Cause3
2904/06/2021 $               34.00Cause3
3004/06/2021 $               76.00Cause7
3104/06/2021 $               45.00Cause8
3205/06/2021 $               50.00Cause1
3305/06/2021 $               60.00Cause2

 

Many thanks in advance.

KL

Labels (1)
3 Replies
Taoufiq_Zarra

Hi@KL1 

in script ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
KL1
Contributor III
Contributor III
Author

Yes, sorry saw the reply too late. I'd prefer to do it by script pls, if not possible by script only then temporarily do it in the charts. 

Thankyou

Taoufiq_Zarra

@KL1  great can you also share the expected output from this sample ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉