Class,Replace,Dual Functions


         I would like to discuss about CLASS,REPLACE,DUAL functions in qlikview. I will explain these functions by taking a sample business scenario.



    U Can observe that for different Sale Id we have different Sale Amount. Now, Our requirement is that our organization wants to organize all the sales based on range.

      Desired output


    Follow , the below steps inorder to obtain the desired output.

    • Right click-->NewSheetObject-->Straight Table
    • In the Dimensions tab,U hav to add calculated Dimension


    CLASS Function



    syntax:- Class([Desired field],range)


    • After adding the Calculated Dimension,click Next
    • Add Expression as count[SaleId]

    The output obtained is,

         Main class.PNG

    Now, if you want to remove '<= x <' symbols in between the numbers, u can use replace function.



    Edit the calculated dimension as -->


    Syntax: Replace([field],'what you want to replace','what should be replaced')

    Output :

    Replace result.PNG

    U can , now observe that '<=  x <' is replaced with '-'.


    However, you can see that range values are not sorted correctly . To, rearrange them in a proper order with equi range distribution You can use DUAL function.



    Edit the calculated dimension as -->



         Dual Result.PNG

    You can now observe that Sales range is ordered accordingly and Count of sales can be observed easily by seeing the above table.


    Final Output:-



    Final output.PNG

    Note: I dn't want to see those sales which are not in range. so,I have checked, Supress Null Values i.e why u can't see 600-700 ,800-900,.....2200-2300 in Sales range column .


      • Like/Mark my document as HELPFUL if u find it useful for you.

    Thanks & Regards,