How to display top 10 values in chart c

Hi everyone i already have a code to select products sales from a database and put it to chart, but its selecting all products. How can i get only 10?

And what should be the query if need the opposite which the top 10 least selling products?

Code:

  private void loadchart()
  {
    chart1.Series[0].Points.Clear();
    chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
    using (SqlConnection connection = new SqlConnection("Data Source=BENJOPC\\SQLEXPRESS;Initial Catalog=MARISCHELLdatabase;Integrated Security=True"))
    {
        SqlCommand command = new SqlCommand("Select ProductName, Sum(QtySold) as QtySold from Sales_productholder group by ProductName", connection);
        connection.Open();
        SqlDataReader read = command.ExecuteReader();
        while (read.Read())
        {
            this.chart1.Series["Pieces Sold"].Points.AddXY(read["ProductName"], read["QtySold"]);
        }
        read.Close();
    }
}

I need help with displaying top 10 values in chart. The problem is because there are a number of column charts with many x-axis values. For many charts, the requirement is to just show the top 5. I can display the chart in descending order sort, but I can't think of a way to do a filter so the chart just show the top 5 or top 10 values. At the moment, I just let the chart show all the values and put in the zoom function to allow them to "zoom" into the top 5 or top 10. I'm not happy with the default display of all the values which looks ugly because of the many, many columns.

Is there a way to set a zoom default so that the chart will display initially the maximum zoom or better still to allow setting the default zoom to a value (so that it will just display top 5). Any advice will be much appreciated if anyone has come across this 'problem' before.

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Search instead for

Did you mean:

  • Qlik Gallery
  • GreenwayOpens new window

Announcements

Introducing Conversational Analytics in Microsoft Teams: READ MORE

  • Qlik Community
  • All Forums
  • QlikView App Dev
  • Pie Chart Showing Just top 10 Values
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page

cancel

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Search instead for

Did you mean:

How to display top 10 values in chart c

Not applicable

‎2013-12-04 09:30 AM

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Hi,

I am wondering how can I show on the graph top ten highest apps staff ID as below:

App IDStaff ID152647132412524597781155497141313131264644661464646164874747997975344343143343412634646345846946546464145646476469476476464764646854646469644646103533131136421616193101012121985864150870715179755566208640417237525268266410119295294961032417981113530646612381949511341083436144397192115468604061497488913

  • new_to_qlikview

Ditto - same here!

5,188 Views

0 Likes

Reply

  • All forum topics
  • Previous Topic
  • Next Topic
  • Previous Replies
  • * 1
    • 2
    • 3
  • Next Replies

1 Solution

Accepted Solutions

How to display top 10 values in chart c
MK_QSL

MVP

‎2013-12-05 05:13 AM

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Try to download latest version and install in your PC.

Click on Add Calculated Dimensions and add below

\=IF(Aggr(Rank(COUNT(DISTINCT [App ID])),[Staff ID])<=10,[Staff ID])

Replace your field name Application_ID ....

Ditto - same here!

3,954 Views

0 Likes

Reply

22 Replies

How to display top 10 values in chart c
MK_QSL

MVP

‎2013-12-04 09:57 AM

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

see attached

Untick show others in dimension limit

MRK013 Pivot TOP 10.qvw

3,543 Views

1 Like

Reply

How to display top 10 values in chart c

Not applicable

‎2013-12-04 10:06 AM

Author

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Could you please paste screenshot as I cant download attached file

3,543 Views

0 Likes

Reply

How to display top 10 values in chart c
MK_QSL

MVP

‎2013-12-04 10:18 AM

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Here we go

3,543 Views

1 Like

Reply

How to display top 10 values in chart c

Not applicable

‎2013-12-04 10:31 AM

Author

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Apologies, I could not see Untick show others in dimension limit. Could you pleae tell step by step as I am new in Qlikview. I want top 10 highest apps staff Ids from 1 to 10 please

3,543 Views

0 Likes

Reply

How to display top 10 values in chart c

How to display top 10 values in chart c
ngulliver

Partner - Specialist III

‎2013-12-04 10:37 AM

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Hi, Shoaib.

Go to Properties for your Pie Chart. Go into the Dimension Limits tab. There you can select limits button and show largest 10 values.

Regards,

Neil

3,543 Views

0 Likes

Reply

How to display top 10 values in chart c
MK_QSL

MVP

‎2013-12-04 10:39 AM

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

RIght Click - New Sheet Object - Chart and Select Pie Chart

Dimension = Staff ID

Dimension Limit

Tick Restrict Which Values are .....

Show Only Largest 10

Option

Show Others = UNTICK

Expression 1

COUNT(DISTINCT [App ID])

Expression 2

IF(COUNT(DISTINCT [Staff ID])=1,'ID '&[Staff ID])

326 KB

3,543 Views

0 Likes

Reply

How to display top 10 values in chart c

Not applicable

‎2013-12-05 04:27 AM

Author

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Thanks Manish, I don't have Dimensions limit tabl but have presentation tab and there can select Max no of slices. So I selcted 10 so think it's showing top 10 values

3,543 Views

0 Likes

Reply

How to display top 10 values in chart c

Not applicable

‎2013-12-05 04:27 AM

Author

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Thanks Neil, I don't have Dimensions limit tabl but have presentation tab and there can select Max no of slices. So I selcted 10 so think it's showing top 10 values

What do you click to remove a data series from a chart so that you can focus on other data series?

on the right of the graph, uncheck the data series and/or categories you want to hide, and click Apply. To edit a data series, click the Edit Series button to the right of the data series. The Edit Series button appears as soon as you hover the mouse on a certain data series.

Which tab has to be accessed to select a chart type in Excel from the charts group?

Click the Insert tab. In the Charts group, Excel provides you with a number of different chart type options: column, line, pie, bar, area, scatter, or other chart. Once you have clicked the chart type you want, a menu will open showing more available chart styles within that type. Click the chart style you want.