Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Aug 22, 2024 4:58:37 AM
Aug 22, 2024 4:58:37 AM
Data values in Qlik Sense are stored as dual values, which means that they have an underlying numerical value and a textual presentation value. This is important to understand before (re)formatting values.
Num(number, format) format function can be used to load a numeric value, number, and store it as a dual value where the presentation is stored according to the format.
For example, Num(1050.75, ‘#,##0.0’) will be stored as numeric value 1050.75 with the presentation rounded to one decimal value as 1,050.8.
The general numeric precision in Qlik Sense is 14 digits. By using a format string with 14 # characters, the engine will interpret the number as a generic 14-digit value.
For example, Num(1050.75, ‘##############’) will be stored as numeric value 1050.75 with the presentation sustained as the input value 1050.75.
The num #(text, format) function allows reverse formatting, where a text is parsed according to the format string as a numeric value. The text value becomes the presentation value and the interpreted numeric value is stored as the underlying value.
In Qlik Cloud, the reporting service requests the visualization data from the Qlik Engine. In this data set, each column has one format stored by the engine, which is used by the reporting service to format columns in the exported Excel sheet.
Columns with mixed formats (numbers and text) will be treated as undefined, and can be expected as text in the exported Excel.
Columns with mixed numeric formats will be exported in a uniform format. Columns formatted with ############## are interpreted as generic numeric values by the reporting service. The output format in Excel in this case becomes General.
There are two ways to apply the generic format to mixed numeric fields or chart columns:
There is naturally a maintenance benefit in controlling formats as much as possible in the script so that object-level formatting can be avoided to the most possible extent.
For data processed through the QVD layer, it may be a further optimization to format the data closer to the source to benefit from the preformatted data as it is ingested through an ETL flow.