Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Class,Replace,Dual Functions

Hi,

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

upload.PNG

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

upload1.PNG

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.PNG

    

CLASS Function

     CLASS1.PNG

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

Class3.PNG

  • 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.

Replace 

Edit the calculated dimension as -->

     Replace.PNG

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

Output :

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

Replace result.PNG

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.

DUAL

Edit the calculated dimension as -->

Dual.PNG

Output:

     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,

  1. K.bharat
1 Reply
sunny_talwar

Thanks for sharing.


I would also suggest you to attach the qvw file also for people to explore this on there own.


Best,

Sunny