Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with If expression in Pie chart

Hello Guys,

I have a query regarding the Pie Chart . As per my scenario I have to segregate the values of pie as follow

If srnumber is =1 then One

If srnumber is =2 then Two

If srnumber is =3 then Three

If srnumber is >=3 then 'All'

first 3 condition can be achieved but in the last case I am unable to rectify the issue or what is going wrong.

Thanks in advance , any help is appreciated.

8 Replies
neelamsaroha157
Specialist II
Specialist II

Check this out

robert_mika
Master III
Master III

I believe the calculation dimension should say:

=If(srnumber >3 ,'All', srnumber)

BTW: Calculated dimension are not very efficient.

it would be better to create a new field at the script level using the same logic

Load:

.

.

If(number >3 ,'All', srnumber) As  YourPreferedName





Feeling Qlikngry?

How To /Missing Manual(25 articles)

Not applicable
Author

Hello Neelam,

1st of all thanks for reply. the condition which you used by that we can not see that how many records are there in the specific pie. Hence, it is partially correct to get the desired output. By the way I get the solution by adding calculated field as below.

=if(Srnumber=3 ,3,
if(Srnumber=1 ,1,
if(Srnumber=2 ,2,
if(Srnumber>=3 ,'All',
))))


neelamsaroha157
Specialist II
Specialist II

So did it work or you are still working on the measure part???

robert_mika
Master III
Master III

Sorry for being picky:

Is that really correct?

=if(Srnumber=3 ,3,
if(Srnumber=1 ,1,
if(Srnumber=2 ,2,
if(Srnumber>=3 ,'All',
))))

Not applicable
Author

Hello Robert ,

Yes It is correct.we have to create calculated dimension using the above formula and in expressions we have to give the count for srnumber (i.e. Count(srnumber)).

Anil_Babu_Samineni

Does Robert Mika Expression suitable for you?

Or exactly, see this

=If(srnumber =1,'One',If(srnumber =2,'Two',If(srnumber =3,'Three',If(srnumber >3,'All'))))

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
robert_mika
Master III
Master III

My concern was related to the calculation:

Yuu got >=3 and =3.

This way some of the values are being calculated twice.