Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
CSmith
Contributor
Contributor

Percentages in expressions in Qlikview

I can't get all of the percentages to  display  correctly in my report. This is my formula;

=((sum({<MTH={'January'}>}sold)+ sum({<MTH={'February'}>}sold)+ sum({<MTH={'March'}>}sold)/sum({<MTH={'January'}, year={$(=GetFieldSelections(year)-1)}>} sold)+sum({<MTH={'February'}, year={$(=GetFieldSelections(year)-1)}>} sold)+sum({<MTH={'March'}, year={$(=GetFieldSelections(year)-1)}>}sold))-1

Number field is: Fixed to and Format Pattern is #,##0%;(#,##0%)

Some of the percentages seems to displaying correctly while some of the others are not.

I have attached some of my results for review. Can anyone tell me what I am doing wrong??

Labels (1)
6 Replies
MarcoWedel

please explain how you calculated your expected results.

CSmith
Contributor
Contributor
Author

Expected results were calculate. See below example;

sold items for January (2021)+ sold items for February (2021) + sold items for March (2021) / sold items for January (2020) + sold items for February (2020) + sold items for March (2020) then 1 was substracted from that number

385+629+1,116 = 2130 / 995+1,770+2,172 = 4937 = 0.431436-1 = -0.568 (57%)

Hopefully this helps.

 

MarcoWedel

Could you please explain for rows 3 and 6 (yellow) in your example as well (best using separate steps)?

MarcoWedel_1-1645731094307.png

thanks

Marco

 

CSmith
Contributor
Contributor
Author

 What I am trying to accomplish is the difference in sales for a particular company, in a percentage format, between the first quarter of 2021 and the first quarter of 2020.  

#3

Jan(21), Feb(21) and Mar(21) are being added together. That number will be divided by the number you get from adding Jan(20), Feb(20) and Mar(20). That number will be substracted from 1. That number should be displayed in % format. The parentheses and the number being displayed in red denotes that is a negative percentage amount.

0 + 0 + 0 = 0 / 6 + 0 + 0 = 6; 0/6 = 0; 0 - 1 = -1. I would expect the answer for Quarter % YOY to be (1%) not (100%)

#6

Jan(21), Feb(21) and Mar(21) are being added together. That number will be divided by the number you get from adding Jan(20), Feb(20) and March (20). That number will be substracted from 1. That number should be displayed in % format. The parentheses and the number being displayed in red denotes that is a negative percentage amount.

7 + 5 + 5 = 17 / 1 + 0 + 0 = 1; 17/1 = 17; 17 -1 = 16. I would expect the answer for Quarter % YOY to be (16%) not (1600%)

I hope this helps.

 

MarcoWedel

Why do you accept a result of -0.568 to represent -57%, when at the same time you expect -1 to be -1% and -16 to be -16% ?


CSmith
Contributor
Contributor
Author

Thank you. I figured it out.