Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
cmorri1988
Creator
Creator

Formatting 1 Decimal Number to Money?

Hi there,

would like to transform the following numeric 1 decimal values to money within the script?

From   To

0         $0.00

0.1      $0.10

0.2      $0.20

1         $1.00

1.1      $1.10

Please can I ask how I might do this?

Thanks

3 Replies
YoussefBelloum
Champion
Champion

Hi,

I suggest to let is as it is (numeric) and format it as money on the front-end on the properties on the object

cmorri1988
Creator
Creator
Author

Thanks, I would like the selection bar to show the finale money values and not an expression however, and so would like to transform within the script and not the front end.

I notice money() creates the desired output when using within an object, but not when applying to the script.

Thanks

cmorri1988
Creator
Creator
Author

For anyone interested in doing the same, this solution seemed to work.

Thanks

---------


For i = 0 to 10

Let dec =  $(i)*0.1;

Min_Price:
LOAD
MONEY(NUM(RecNo()-$(dec)),'$#######.#0') AS "Min Price",
    NUM(RecNo()-$(dec)) AS "Min Price Num"
AutoGenerate(1000000);

Max_Price:
LOAD
MONEY(NUM(RecNo()-$(dec)),'$#######.#0') AS "Max Price",
    NUM(RecNo()-$(dec)) AS "Max Price Num"
AutoGenerate(1000000);

next i;

exit script;