Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help with a line chart?

Hi,

I am trying to create a line chart that displays by month the top 10 of more requested items. The proble that I am having is that I want to display the 100% by month (besides that the top 10 is not the 100%).

If I use a count or sum and in the dimension limits set the 10 as max numbers will partially work. But I want to have the % of each item of the total of items for each months.

Is there a way to do this or I mixed all and confuse everyone?

Thanks,

1 Solution

Accepted Solutions
swuehl
MVP
MVP

That's probably because you are using TOTAL qualifier without the field list:

Count({$<Code= {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -12)
AND
Date#(YRMON, 'YYYY-MM') <= MonthEND(Today(), -1) "
}>} DISTINCT Code)/

Count(Total<MonthDimensionField> {$<Code= {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -12)
AND
Date#(YRMON, 'YYYY-MM') <= MonthEND(Today(), -1) "
}>} DISTINCT Code)

View solution in original post

10 Replies
vishsaggi
Champion III
Champion III

Can you share some sample data with expected output please?

Anonymous
Not applicable
Author

This is a small example:

   

MonthItemQty
1160
128
1315
1443
156
2113
2225
2330
246
2562
3126
3238
3325
3419
354
4150
4262
4332
4428
4515

So, I want to display for month the top 3 items, in percentage for the total of that month. For example in the month 1 should display Item 1 (60/132), 3 (15/132), and 4 (43/132), next month should display 2(25/136), 3(30/136) and 5 (62/132).

Please let me know if it's clear now.

swuehl
MVP
MVP

Have you tried with your dimension limits and an expression like

=Sum(TOTAL<Month> Qty)

resp.

=Sum(Qty) / Sum(TOTAL<Month> Qty)

vishsaggi
Champion III
Champion III

Hello Stefan, How did you get the top 3 in your file. When i checked it does not have dimension limits checked. Still it shows Top 3 values?

swuehl
MVP
MVP

It has dimension limits checked on Item

2017-10-13 19_12_23-QlikView x64 - [E__Users_Stefan_Downloads_comm278000.qvw_].png

vishsaggi
Champion III
Champion III

So sorry I was blind. Got it. I was about to give him exactly Sum(Total <Month> Qty) but was not checking this tab and was fiddling around. 

Anonymous
Not applicable
Author

It's what I need, but instead of a sum, I am trying to counting the codes (I don't have quantity). This is the expression that I have:

Count({$<Code= {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -12)
AND
Date#(YRMON, 'YYYY-MM') <= MonthEND(Today(), -1) "
}>} DISTINCT Code)

I am counting the number of times that one specific code appears and grouping it by status.

In this example I counting how many of them appear in the last 12 months without count current month. As dimension I have the month and the status.

I have tried to use:

Count({$<CaseClosed = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -12)
AND
Date#(YRMON, 'YYYY-MM') <= MonthEND(Today(), -1) "
}>} DISTINCT CaseClosed)

/

Count(Total{$<CaseClosed = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -12)
AND
Date#(YRMON, 'YYYY-MM') <= MonthEND(Today(), -1) "
}>} DISTINCT CaseClosed)

But didn't work. Any idea?

swuehl
MVP
MVP

'Didn't work' is not a good issue description.

Please post a sample QVW and your requested result.

Anonymous
Not applicable
Author

Didn't work means that there is not any difference between the results of using:

Count({$<Code= {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -12)
AND
Date#(YRMON, 'YYYY-MM') <= MonthEND(Today(), -1) "
}>} DISTINCT Code)

and

Count({$<Code= {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -12)
AND
Date#(YRMON, 'YYYY-MM') <= MonthEND(Today(), -1) "
}>} DISTINCT Code)/

Count(Total{$<Code= {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -12)
AND
Date#(YRMON, 'YYYY-MM') <= MonthEND(Today(), -1) "
}>} DISTINCT Code)

it's displaying the percentage distributed between all months and not by total by month.