Skip to content

Instantly share code, notes, and snippets.

@ralfbecher
Created December 14, 2016 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralfbecher/754e600046ee23eb843ebaabd8cf1bfb to your computer and use it in GitHub Desktop.
Save ralfbecher/754e600046ee23eb843ebaabd8cf1bfb to your computer and use it in GitHub Desktop.
Qlik Nice Number Format
//---------------------------------------------- Nice Numberformat simplified ---------------------------------------------
// does work with count in KPI object (have seen several versions from Qlik which haven't worked)
Set vF_NiceNumberSimple =
If(Fabs($1) > 1e9, Num($1/1e9+1e-13, '#$(ThousandSep)##0$(DecimalSep)00')
,If(Fabs($1) > 1e8, Num($1/1e6+1e-13, '##0$(DecimalSep)0')
,If(Fabs($1) > 1e6, Num($1/1e6+1e-13, '##0$(DecimalSep)00')
,If(Fabs($1) > 1e5, Num($1/1e3+1e-13,'##0$(DecimalSep)0')
,If(Fabs($1) > 1e3, Num($1/1e3+1e-13, '##0$(DecimalSep)00')
, $1,
))))) &
If(Fabs($1) > 1e9, ' Mrd'
,If(Fabs($1) > 1e8, ' Mio'
,If(Fabs($1) > 1e6, ' Mio'
,If(Fabs($1) > 1e5, ' tsd'
,If(Fabs($1) > 1e3, ' tsd'
, ''
)))))
;
//---------------------------------------------- Nice Numberformat simplified ---------------------------------------------
// usage:
$(vF_NiceNumberSimple(Count(distinct Expression1)))
@ralfbecher
Copy link
Author

@MichelLalancette you could be right. Maybe this hasn't worked in the past?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment