Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

How to create a new measure

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. 

3 Replies
Employee
Employee

Re: How to create a new measure

Hi Teresa,

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.


Josh

-Qlik

Not applicable

Re: How to create a new measure

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. 

dezrrehm
New Contributor II

Re: How to create a new measure

Create a new measure by clicking "Create new" in your master items.

The expression for your measure is just the following:

$(MyVariableName)

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.