Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
craig157
Creator II
Creator II

Need help Calling Decimal Format Variables

Hi All,

I want to be able to change the result format of several charts on a specific sheet I am working on.

I've set up the below three variables.

vFormat_NoDecimals = '+##,##0%; -##,##0%'

vFormat_1Decimals = '+##,##0.0%; -##,##0.0%'

vFormat_2Decimals = '+##,##0.00%; -##,##0.00%'

What would be the easiest way to select which format appears on my charts and etc?

I was thinking of setting up another three variables that would change the active status from 0 to 1 but just want to see what everyone thinks before I try setting it up.

Thanks,

Craig

1 Solution

Accepted Solutions
Anil_Babu_Samineni

See, Normally how this happens

SET vFormat_NoDecimals = '+##,##0%; -##,##0%'

SET vFormat_1Decimals = '+##,##0.0%; -##,##0.0%'

SET vFormat_2Decimals = '+##,##0.00%; -##,##0.00%'

And then Num(Sum(Measure), vFormat_NoDecimals)

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

View solution in original post

9 Replies
Anil_Babu_Samineni

What are you going to get using this variable?

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

So in my chart I display a value like "Colour Ratio 45%" which would use vFormat_NoDecimals.

Ideally it would use these variables like this:

vFormat_NoDecimals

vFormat_1Decimals

vFormat_2Decimals

Hope this makes sense.

Anil_Babu_Samineni

Normally, Expression should be

Num(Expression, 'Your Format')

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

Anil - that is already happening... I am trying to make the 'Your Format' into a variable I can change to the three variables I've already advised so we can have different formats depending on the Users Selection.

Anil_Babu_Samineni

See, Normally how this happens

SET vFormat_NoDecimals = '+##,##0%; -##,##0%'

SET vFormat_1Decimals = '+##,##0.0%; -##,##0.0%'

SET vFormat_2Decimals = '+##,##0.00%; -##,##0.00%'

And then Num(Sum(Measure), vFormat_NoDecimals)

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

Thanks Anil,

So now I have a new issue!

In my equation I've got a new variable vFormat_FormatSelecter which I will assign vFormat_NoDecimals too when a button is selected. And another button for vFormat_2Decimals and etc.

Unfortunately when entered this way it is just bringing up the text name of the variable and not formatting the answer.

Any ideas?

Thanks

Anil_Babu_Samineni

Not sure i followed, Can you help us to show the expected result. That would be offer more clear rather functional. And what i understand is Auto Hide show objects.

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

See the images I sent previously would be the end result....

So I would define the original equation to be:

vFormat_FormatSelecter



On another section of my layout I have three buttons that set the variable vFormat_FormatSelecter

Button 1 - vFormat_NoDecimals            this has been set as '+##,##0%; -##,##0%'

Button 2 - vFormat_1Decimals           this has been set as '+##,##0.0%; -##,##0.0%'

Button 3 - vFormat_2Decimals          this has been set as '+##,##0.00%; -##,##0.00%'

Anil_Babu_Samineni

True, In each image you need to use all buttons, But unfortunately button doesn't have future called Number format in Qlikview.

1) Create 3 buttons and assign variable with empty value and then call them as in Button with Variable from external section to each chart

2) Finally, You could call each variable to each chart of format where you are indeed.

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