Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

Selecting decimal places dynamically

Hi,

I am very much new to QlikView...just started with this tool....

I have a requirement...there is a revenue column in my dashboard, in which numbers appear till 15 decimal places. My requirement is to make an input field- in which user can put no. as per his choice(0-15), and depending upon the number inserted(0-15) decimal places should appear.

For eg:- If I say 5 decimal places, revenue in the column should appear till 5 places of decimal only.

Can you guys help me with this requirement.

Cheers

Ali

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: Selecting decimal places dynamically

Maybe use a variable vFormat that creates a format string from the user input vNumberOfDigits:

='#,##0.' & Repeat('0',vNumberOfDigits)

(adapt format to your needs, e.g. the integer part)

Then, in your chart, use something like

=Num( Sum(Revenue), vFormat, '.',',')

View solution in original post

5 Replies
Highlighted
MVP
MVP

Re: Selecting decimal places dynamically

Maybe use a variable vFormat that creates a format string from the user input vNumberOfDigits:

='#,##0.' & Repeat('0',vNumberOfDigits)

(adapt format to your needs, e.g. the integer part)

Then, in your chart, use something like

=Num( Sum(Revenue), vFormat, '.',',')

View solution in original post

Highlighted
Specialist III
Specialist III

Re: Selecting decimal places dynamically

Stefan's approach above should work. If you prefer modifying the actual value to get sums consistent with your display (that is, rounding it off or flooring it), you could also use:

Floor(YourValue,1/(pow(10,vNumOfDigits))

You can also replace Floor() with Round() depending on the behavior you want.

e.g. for three digits selected and a value of 1.23456, this would resolve to:

Floor(1.23456,1/10^3)

=

Floor(1.23456, 0.001)

=

1.234

Round() with the same values would result in 1.235.

Highlighted
Contributor II
Contributor II

Re: Selecting decimal places dynamically

Hi,

I tried implementing, but can't get through it...can you please explain it more?

Also can you please explain the integer format and how to implement it as per the requirement?

Cheers

Ali

Highlighted
MVP
MVP

Re: Selecting decimal places dynamically

Freeky Ali wrote:

Hi,

I tried implementing, but can't get through it...can you please explain it more?

Also can you please explain the integer format and how to implement it as per the requirement?

Cheers

Ali

How could I explain the integer format as per your requirement without knowing your requirement?

The format code is somewhat explained in

Conventions for number and time formats ‒ QlikView

If you need help with creating the variable for the format, then please

- specify your format requirements

- post a small sample QVW with your current status, i.e. the input field and variable definition.

Highlighted
Contributor II
Contributor II

Re: Selecting decimal places dynamically

Thank you soo much for your help.

I implemented your solution and honestly speaking you just nailed it.

I was actually looking for this solution only.

Thanks again for making my day.


Cheers

Ali