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:

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

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]]

Chủ Đề