Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Bad name field on division expression

Dear All,

I am new on qlik and trying to create a %KPI I am struggling with bad name error. I two fields (columns on original excel table):

Fields: [ACT atBGTYTD 2018] and [BGT YTD 2018]

I have already created other KPIs calculating the sum of each field, separately, and it works.

However, when I try to set a KPI showing the percentage of ACT out of BGT figures, it returns bad name error. It starts when I insert the operator "/" to divide the two previous expressions.

Expression is: (sum([ACT atBUD YTD 2018])/sum([BGT YTD 2018]))/100

The error is: Bad Field name: [BGT YTD 2018]

** Additional information:

1. If I make the same division by a random number it works well. Ex. (sum([ACT atBUD YTD 2018])/2500)/100

2. If change the order of fields on expression, the error also changes. Ex. (sum([BGT YTD 2018]))/sum([ACT atBUD YTD 2018]))/100 - Erro changes to: Bad Field name: [ACT atBUD YTD 2018]


If anyone has an idea of what is happening, please help me!!


Thanks in advance!

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Dear All,

I could find a way to solve my problem. I have changed the name of the columns on the data manager. Apparently, the spaces between letters was a problem.

Thank for your help!

Regards,

Fernanda

View solution in original post

7 Replies
wdchristensen
Specialist
Specialist

You can eliminate the division by 100 and use the format pattern to handle the percentage.

What happens if you try: sum([ACT atBUD YTD 2018])/sum([BGT YTD 2018])

OR

=sum("ACT atBUD YTD 2018")/sum("BGT YTD 2018")

ExamplePercent.PNG

balabhaskarqlik

You can use the expression like this: sum([ACT atBUD YTD 2018])/sum([BGT YTD 2018])

And change your percentage formatting like below, then it'll give the percentage values as below:

The below one used to calculate Margin%

Got the Margin% as below:

Anonymous
Not applicable
Author

Dear William,

Thank you very much for your response. I tried both eliminate the division by 100 and change expression to =sum("ACT atBUD YTD 2018")/sum("BGT YTD 2018") and it does not work.

Also, as the expression automatically splits when I enter it, and I tried to put the expression all together on the same line and then both fields (ACT atBUD YTD 2018 and BGT YTD 2018) appear as bad field name. This makes me think that there is any misalignment on how the script is originally writen and how the expression returns it on the expression editor. Is it possible? 

Anonymous
Not applicable
Author

Dear Bala,

Thank you very much for your help too. I tried that, but it does not work.

As per the answer above this makes me think that there is any misalignment on how the script is originally writen and how the expression returns it on the expression editor. Is it possible? 

balabhaskarqlik

May be there's an issue in the scripting part.

Anonymous
Not applicable
Author

Dear All,

I could find a way to solve my problem. I have changed the name of the columns on the data manager. Apparently, the spaces between letters was a problem.

Thank for your help!

Regards,

Fernanda

balabhaskarqlik

That's a good try, please mark it as answered and close this thread.