Announcements
cancel
Showing results for
Did you mean:
Specialist

## Trouble with using variables in a script

I'm trying to building each chart cell's value by using a variable for each one in my script.  It is tedious work but I need to be able to use various cell values, which can be from different unrelated charts) to do math on them or to just be able to show a column total  in a text box since the row values are to be hidden and not part of a chart.  With that said, I am running into something odd that I cannot figure out, nor understand, and am hoping someone can help explain it and how to get around it to get it to work.  Variables are not my strong suit, so I'm sure I'm coding something incorrectly.  See the attached qvw for details, but basically when I want to reuse input variables in multiple expressions, in some of the expressions build from other expressions, when the input variables change the expression value are not changing nor reflecting the revised value.  Thanks.

1 Solution

Accepted Solutions
MVP

So, I think this is Math problem at hand for the Yellow

Value (Cov * Hours * Factor) = Cov * Hours * [Factor (Actual / Available)]

Value (Cov * Hours * Factor) = Cov * Hours * (Actual / [Available (Cov * Hours * Days)])

Value (Cov * Hours * Factor) = Cov * Hours * (Actual / Cov * Hours * Days)

Now Cov and Hours cancel each other out to leave with this

Value (Cov * Hours * Factor) = Actual / Days

So, changes in Cov and Hour won't really change Value (Cov * Hours * Factor) because it is only dependent on Actual and Days

3 Replies
MVP

So, I think this is Math problem at hand for the Yellow

Value (Cov * Hours * Factor) = Cov * Hours * [Factor (Actual / Available)]

Value (Cov * Hours * Factor) = Cov * Hours * (Actual / [Available (Cov * Hours * Days)])

Value (Cov * Hours * Factor) = Cov * Hours * (Actual / Cov * Hours * Days)

Now Cov and Hours cancel each other out to leave with this

Value (Cov * Hours * Factor) = Actual / Days

So, changes in Cov and Hour won't really change Value (Cov * Hours * Factor) because it is only dependent on Actual and Days

MVP

Cyan has the same problem... let's start from where we left in the last expression

Rev (Value * Days) = [Value (Cov * Hours * Factor)] * Days

Replace [Value (Cov * Hours * Factor)] with Actual / Days

Rev (Value * Days) = (Actual / Days) * Days

Leaving us just with Actual which will not be impacted by anything because this will only change if you change vActual1 or vActual2

Specialist
Author

Oh boy, how silly do I feel, especially after going back to the excel document I am trying to replicate and testing it there too, only to find that yes, those values didn't change in that xls doc either.  I sent myself down a bunny hole for no reason, how embarrassing.   Sorry to waste your time Sunny, but thank you so much for opening my eyes...hopefully you at least get some Qlik points for your effort.

Community Browser