Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
christophebrock1
Contributor II
Contributor II

Show comma only when value smaller than 1

Hello,

I'm looking for the format pattern to convert a number into a number with a decimal, but only when the value goes below 1.

So for example:

10

8

3

1

0,9

0,3

Anyone has an idea?

Kind regards,

Christophe

9 Replies
hic
Former Employee
Former Employee

Try

Num(Number,If(Number>=1,'0','0.0'),'.',',') as FormattedNumber

HIC

hic
Former Employee
Former Employee

...or with decimal comma:

Num(Number,If(Number>=1,'0','0,0'),',','.') as FormattedNumber

Chanty4u
MVP
MVP

try this

aa:

LOAD * INLINE [

    sam, F2

    10

    8

    3

    1

    0, 9

    0

];

LOAD

if(sam<1,'0','0.0') as new

Resident aa;

christophebrock1
Contributor II
Contributor II
Author

Thanks but I'm having these numbers generated in a barchart by selecting "Relative" (so I'm getting the percentages).

I want to format that "generated" number, as the load script doesn't work for me.

hic
Former Employee
Former Employee

You can use the formula I suggested as expression in the bar chart:

Image1.png

hic
Former Employee
Former Employee

But you may need to create the "relative" part inside your formula, e.g.

Image2.png

christophebrock1
Contributor II
Contributor II
Author

Thanks, seems legit, but there's no easy formatting shortcode that can be used?

hic
Former Employee
Former Employee

Unfortunately not...

christophebrock1
Contributor II
Contributor II
Author

Ok, thanks for all the help !!