Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
stubarnes
Contributor II
Contributor II

Format Class ranges as currency

Hi I have the following but would like the formatting of numbers to be displayed as currency

=Dual(Replace(Class(TP,500),'<= x <','-'),Class(TP,500))

I tried inserting Money('£#,##0') before replace but did not work..

Any ideas?

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Perhaps something like this:

Dual( Money( Floor(TP,500) , '£#,##0') & '-' & Money( Ceil(TP,500) , '£#,##0') , Floor(TP,500))


talk is cheap, supply exceeds demand

View solution in original post

8 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Perhaps something like this:

Dual( Money( Floor(TP,500) , '£#,##0') & '-' & Money( Ceil(TP,500) , '£#,##0') , Floor(TP,500))


talk is cheap, supply exceeds demand
MarcoWedel
MVP
MVP

Hi,

some solutions might be:

=Dual('£'&Replace(Class(TP,500),' <= x < ',' - £'),Class(TP,500))

=Dual(Money(Floor(TP,500),'£#,##0')&'-'&Money(Floor(TP,500)+500,'£#,##0'),Floor(TP,500))

hope this helps

regards

Marco

BalaBhaskar_Qlik
Master
Master

May be this:

=Dual(Replace(Class(TP,500),'<= x <','to'), Num(Class(TP,500)))

BalaBhaskar_Qlik
Master
Master

stubarnes
Contributor II
Contributor II
Author

Thanks for your help on this, works perfectly!

If I could ask an additional question, is it possible to format the numbers as a percentage #,##0.0%

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Yes, with the num function instead of the money function.


talk is cheap, supply exceeds demand
MarcoWedel
MVP
MVP

Hello gwassenaar,

I noticed a difference in the results of the Class() vs. Floor()/Ceil() approach due to Floor and Ceil both letting integer values unchanged. Can you check?

thanks

regards

Marco

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Yeah, if a value falls exactly on a border value then an incorrect result is returned. Your expression always returns the correct result.


talk is cheap, supply exceeds demand