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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
antonaks
Creator II
Creator II

Variables from Excel

I ask for help in working with variables.

I load variables from an Excel file.
For example, vFact and vPlan. After I begin to conduct mathematical operations on them, the result behaves quite strangely.

For example, the expression =$(vFact) / $(vPlan) displays a huge number, although if you take the value of each variable separately, everything is fine.



17 Replies
antonaks
Creator II
Creator II
Author

Sorry.

If vFact / vPlan I get NULL.

Anil_Babu_Samineni

Actually I've tested in my end and it's working as expected. Can you share QVW to investigate.

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
antonaks
Creator II
Creator II
Author

Unfortunately, I can not send the current qvw.
But I managed to solve the problem.

If you put the variables and the operator one by one with a new line, then everything works.


Like this:

$(FactSales_CM_TD_Exec)

/

$(PlanSales_CM_TD_Exec)

Kind of weird...

Anil_Babu_Samineni

I doubt, How function works in engine(QIX) level. Let me share some inputs

$(FactSales_CM_TD_Exec)  = Sum(Sales)/10

PlanSales_CM_TD_Exec = Sum(Sales1) / 20


When we are doing

$(FactSales_CM_TD_Exec) / $(PlanSales_CM_TD_Exec)

Sum(Sales)/10 / Sum(Sales1)/10 // Here, engine works as alternative of division to each

($(FactSales_CM_TD_Exec)) / ($(PlanSales_CM_TD_Exec))

(Sum(Sales)/10) / (Sum(Sales1)/10) // Here, engine works as expected because of parenthesis we are division

Does this make sense, I am assuming same thing in your file. If you share some related information at least we will try our best.

Note - If you happy with the answer, Please mark your response as correct answer and other helpful where you fell help.

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
antonaks
Creator II
Creator II
Author

By trial and error, I came to this result.

I do not understand why, but if you write each variable in a new line, it works as it should.


// Not work

$(FactSales_CM_TD_Exec) / $(PlanSales_CM_TD_Exec)

// Good work

$(FactSales_CM_TD_Exec)

/

$(PlanSales_CM_TD_Exec)

// If use braces, they must be write in new line too

// Good work (if use braces)

(

$(FactSales_CM_TD_Exec)

/

$(FactChecks_CM_TD_Exec)

)

/

(

$(PlanSales_CM_TD_Exec)

/

$(PlanChecks_CM_TD_Exec)

)

Anil_Babu_Samineni

Just to know where you are trying this? In fact, If you share some sample load variable expression to qlikview. Then that would be great. I am sorry May be i am not helps you this time

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
antonaks
Creator II
Creator II
Author

I'll give you an example, just a little later. Now very busy. So please forgive me.

antonaks
Creator II
Creator II
Author

I put an example. If you have questions please ask

Example_pic.png