Discussion board where members can get started with Qlik Sense.
Hi, I'm very new to Qlik Sense and need to know how to create a new measure from existing measures. For example, I need to calculate gross margin based on sales and cost. I've watched many videos but have not found this specific action.
It is not possible to use a measure to create a new measure. However, what you can do is use variables. https://help.qlik.com/en-US/sense/3.1/Subsystems/Hub/Content/Variables/use-variables-expression.htm
So for example, you could create a variable that you could call 'vSales' which would be defined as Sum(Sales) and a variable called 'vCost' which could be defined as Sum([Costs of Goods])
Then you can create a new variable that you could call vMargin and define it as
($(vSales) - $(vCost)) / $(vSales)
Note the "$" is used to tell Qlik to evaluate the variable in the brackets and return the result.
Thank you Josh, I was able to create the variables, but now how do I use them in a visualization? It seems that I can only select dimensions and measures.
Create a new measure by clicking "Create new" in your master items.
The expression for your measure is just the following:
Give the measure a name, and optionally a description or tags, and click Create.
That's all there is to it.
There are some technicalities if you are looking to represent varying aggregation levels, or if you are using variables for Labels or in If statements - but most of the time it's pretty simple.