1 Reply Latest reply: Aug 28, 2016 4:50 AM by Liron Baram RSS

    I would like to create a histogram with the following data:

    Michele Van Laningham

      I have looked through qlik forums but still cannot make this work.  Any help would be greatly appreciated! 

       

      Using Qlik Sense:

       

      I have a field with number of days from promised date to delivery date.  I would like to capture the frequency of days in bins from 1-9 (with greater than 9 days  dumped into a single frequency).

       

      What are the steps to do so?

       

      • I have added the following to my load statement to set the bins

      data:

      LOAD

      round(rand() * 2000) as Value

      AutoGenerate 500;

       

       

      Bins: LOAD * INLINE [

      Bin, Start, Stop

      bin1, 0

      bin2, 1

      bin3, 2

      bin4, 3

      bin5, 4

      bin6, 5

      bin7, 6

      bin8, 7

      bin9, 8,

      bin10, 9, 9999999

      ];

       

      IntervalMatch(Value)

      LEFT Join(Bins)

      LOAD Start, Stop resident Bins;

      DROP FIELDS Start, Stop;

       

       

      • created a chart with a dimension of 'bin'
      • created a measure of count(days)

       

       

      This is working   Can anyone help?

       

      Thanks!!

        • Re: I would like to create a histogram with the following data:
          Liron Baram

          hi

          try this script , it should give you the desired results

          the measure in the chart should be count(Value)

          data:

          LOAD rowno() As ID ,

          round(rand() * 10) as Value

          AutoGenerate 500;

           

           

          Bins:

          LOAD * INLINE [

          Bin, Start, Stop

          bin1, 0,0.9999999

          bin2, 1,1.9999999

          bin3, 2,2.9999999

          bin4, 3,3.999999

          bin5, 4,4.9999999

          bin6, 5,5.999999

          bin7, 6,6.999999

          bin8, 7,7.999999

          bin9, 8,8.9999999

          bin10, 9, 9999999

          ];

          ///////////connect values

          Inner Join IntervalMatch(Value)

          LOAD Start, Stop resident Bins;

          ///////////add all records to the bins table

          left join (Bins)

          load * resident data;

          ////////////droping unrelevant table //////

          DROP table data;

          ////////////droping unrelevant fields /////////////

          drop field Start,Stop;