Percentage functions 🧮

Danny Roden
Danny Roden Administrator
edited January 29 in Functions library

Summary

This package contains a couple of functions but may be updated in the future to include others.

Format Number as a Percentage 🔣

This is a function, suggested by @George_Stephen and intended to be used to help create a presentation form of percentages for use on dashboards/views. The function takes a numeric input (e.g. 1.2 or 0.05) and formats it as a percentage (multiplying by 100, to the defined number of decimal places and appending the % sign). It also formats values less than 100% in red and above 100% in green.

See below for preview of the function definition logic and some sample output results:

Calculate Percentage 🧮

A mathematical function to calculate a percentage between 2x inputs. It takes 4x inputs and evaluates InputA (e.g. 4) as a percentage % of InputB (e.g. 5) and provides a decimal output (e.g. 0.8). The other parameters allow you to specify if you want it to be formatted (vs presented in raw decimal form) and if formatted, how many decimal places (using the above Format Number as a Percentage function).

See below for preview of the function definition logic and some sample output results:

Compatibility:

These functions are compatible with all instances of Data Studio from v2.12.8 onwards.

Comments