Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
waqasshah
Creator
Creator

Percentage Issue in If Else Condition

Hi Guys,

I am trying to calculate the percentage value if specific criteria meets. I don't know why If Else condition is not working . . The charts will be my proposed output. Please review the attached screenshots. Please help.

Kind Regards

Waqas Shah

Labels (1)
1 Solution

Accepted Solutions
timpoismans
Specialist
Specialist

In the above screenshot, I am simple making use of a bar graph and a selection field of Specialty.

No use of Set Analysis.

I'm afraid I can't share the example file, as I'm using Qlik Sense (.qvf file vs .qvw file)

The solution works on QlikView and Qlik Sense though.

Steps to undertake:

  1. Create a selection field of Specialty.
  2. Make a bar graph
    1. Dimension is Financial Year
    2. Measure is: Sum(DNA)/Sum(total<DNASpecialty,[Financial Year]>DNATotal)
  3. Finished.

You can now use the selection field to switch between the specialties.

If your issue is resolved, please mark the correct answer and/or any helpful answers. Thanks.

View solution in original post

18 Replies
joseph_eftamand
Partner - Creator
Partner - Creator

Have you tried using set analysis?

Sum({<Specialty = {'SpecialtyName'} >} SNA) / Sum({<Specialty = {'SpecialtyName'} >} Total SNA)


Let me know if that works for you.


Thanks,


Joseph

waqasshah
Creator
Creator
Author

Thanks for your reply. No I have not use set Analysis before. I will try this but do you have any idea what's wrong with my script?

Surely I will try set analysis

regards

Waqas Shah

joseph_eftamand
Partner - Creator
Partner - Creator

The SNA field is underlined indicating QV may not recognise the field. Also what tis the field TotalSNA? 

waqasshah
Creator
Creator
Author

I just change the names .. Please have a look now with your set analysis.. but no luck,,, please have a look now

F2.png

joseph_eftamand
Partner - Creator
Partner - Creator

can you send a small sample of data to test?

waqasshah
Creator
Creator
Author

I have attached sample data ..

timpoismans
Specialist
Specialist

Based on your sample data out of Excel:

Percentage Issue.PNG

On the left is the data load, on the right the percentage.

I don't understand the relation between the DNA field and DNA total though.

waqasshah
Creator
Creator
Author

Thanks for your reply. Please review the updated dataset.

DNA means Did Not Attend

DNATotal =  DNA  + Attends

Like We have DNA Speciality called Surgery e.g. . we need to know in the financial year of 2017/2018 what were the percentage of patents who did not attend their clinicians. I hope it makes sense.

Kind Regards

Waqas Shah

timpoismans
Specialist
Specialist

Makes sense.

Please take a look at the image below if this is the desired result:

Percentage Issue_2.PNG

Loaded data is on the left.

Table on the right  gives you the percentage of DNA for that specialty in the financial year.