1 Reply Latest reply: Mar 17, 2016 3:08 AM by Gysbert Wassenaar RSS

    how to display quarter on axis

    naveen kumar

      Hello All,

      my requirement is i need to display current , previous score and there respective quarters for all the location..

      to achieve this i took bar chart

                                    dimension: location,quarter

                                  expression:current score: FirstSortedValue(OVERALL_SCR,-ADATE)

                                                    previous score: FirstSortedValue(OVERALL_SCR,-ADATE,2)

                    by writing this i am getting messed up bar chart (slide 1)

                     

      later i replace the expression:

                  current score:Sum({<ADATE={"$(=max(ADATE))"},YEAR=,QUATERS=,name1=,ENSTEHDAT=>}OVERALL_SCR)

                  pervious score:Sum({<ADATE={"$(=max(ADATE),2)"},YEAR=,QUATERS=,name1=,ENSTEHDAT=>}OVERALL_SCR)

      i got some wired out put (slide 2)...


      last time by writing the second expression(sum()) and adding two dimension it worked out perfectly ,but only thing was see the location fields last time it was only a single field but now it is a common key field,is that because the sum() expression is not work?


      please help in writhing down proper expression...

      please find work file attachment


        • Re: how to display quarter on axis
          Gysbert Wassenaar

          Try using an AsOf table:

           

          AuditScore:

          LOAD 

               WERKS  as LOCATION,

               date(ADATE,'MM/DD/YYYY') AS ADATE,

               Dual(QUARTER,QuarterStart(ADATE)) as QUARTER,

               OVERALL_SCR    

          FROM

            [C:\qlikview\QVDS\AuditScore.qvd] (qvd)

            ;

           

          AsOf:

          LOAD DISTINCT

            QUARTER as ReportQuarter,

            QUARTER as QUARTER,

            'Current' as Period

          RESIDENT

            AuditScore

            ;

          CONCATENATE (AsOf)

          LOAD

            QUARTER as ReportQuarter,

            Dual('Q' and Ceil(Month(QuarterStart(QUARTER,-1))/3), QuarterStart(QUARTER,-1)) as QUARTER,

            'Previous' as Period

          RESIDENT

            AuditScore

            ;

           

          Then use ReportQuarter as dimension instead of QUARTER. And change your expressions to use Period to select the right quarter

          current: sum({<Period={'Current'}>}Amount)

          previous: sum({<Period={'Previous'}>}Amount)