0% found this document useful (0 votes)
28 views8 pages

Qlik Sense Variables Exercise Guide

Qlik Sense Variables exercise.

Uploaded by

Felipe Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views8 pages

Qlik Sense Variables Exercise Guide

Qlik Sense Variables exercise.

Uploaded by

Felipe Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Learning module: Working with Variables

Example Download
Exercise - INSTRUCTIONS The example file supporting this exercise is
available in the ‘Example files’ section of
this learning module. Access the zip
Using the Example Download instructions on the right, open the archive, which contains all of the example
files for this module, and extract its
Variables_Exercises.qvf file. This configured app will be used to provide an
contents.
opportunity for you to practice working with variables in Qlik Sense.
Variables_Exercises.qvf can be opened
in one of the following Qlik Sense
Follow the instructions below to learn more. deployments:

Qlik Sense SaaS (Business, Enterprise


SaaS) instructions:
Use numerical values supplied as variables • Use the Add new button to Upload
app.
• Open the sheet titled: Numerical values supplied as variables.
• Drag & drop the example QVF file
• The visualizations on this sheet relate average transaction amounts
onto the resulting drop target.
in US Dollars. Our goal is to convert these amounts to Japanese
• Upload to your Personal space.
Yen. We will do that by configuring a variable which stores the US
• Click to open uploaded app.
Dollar to Japanese Yen conversion factor.

o Create a new variable.


▪ Name: “vUSDtoJPYconversion”
▪ Definition: 125.6
Qlik Sense Desktop instructions:
▪ Description: “US Dollar to Japanese Yen
conversion factor” • Drag & drop the example QVF file
▪ Tags: “Currency conversion” onto the Qlik Sense Desktop hub

o Apply the variable.


▪ Change the measure for all three visualizations on
the sheet to reflect the measure value times the Qlik Sense Enterprise on Windows
currency conversion factor: instructions:
Avg(Amount)*$(vUSDtoJPYconversion) • May require the assistance of your
Qlik Sense Administrator to Import the
app into your Personal > Work space,
• Review the change in values displayed in each visualization. using the Qlik Management Console.

© 2023 QlikTech International AB. All rights reserved. All company and/or product names may be trade names, trademarks and/or registered trademarks of the respective
owners with which they are associated.
Exercise Instructions | page 1
Use numerical values supplied as variables (cont’d)
• The visualizations should appear as you see below:

• Assume that some time has passed, and the currency exchange rate has changed significantly.

o Edit the vUSDtoJPYconversion variable to define the new exchange factor value: 118.9.

• The visualizations should appear as you see below:

© 2023 QlikTech International AB. All rights reserved. All company and/or product names may be trade names, trademarks and/or registered trademarks of the respective
owners with which they are associated.
Exercise Instructions | page 2
Configure a variable input extension to change the variable value.
• In Edit sheet mode, open the Custom objects section of the assets panel.
o Within the Qlik Dashboard bundle, locate the Variable input extension.

▪ Drag & drop Variable input to cover the top half of the KPI chart object.
• In the Appearance section of the properties panel, expand the Variable
subsection.

o Name: vUSDtoJPYconversion

o Show as: Input box

• Click the button to exit ‘Edit mode’, and test the new variable input by entering a new exchange
factor value: 110.5.

• The visualizations should appear as you see below:

© 2023 QlikTech International AB. All rights reserved. All company and/or product names may be trade names, trademarks and/or registered trademarks of the respective
owners with which they are associated.
Exercise Instructions | page 3
Use expression components supplied as variables
• Proceed to the sheet titled: Expression components supplied as variables.
• This sheet shows a bar chart which has been configured to display merchant totals as labels on
each bar, as well as an overall total and an overall average transaction amount displayed in the
Title and Subtitle areas, respectively.

Note that the number formatting across these values is inconsistent. Our goal is to use the
Num() function, in combination with a variable, in order to make the format of all of these value
labels consistent.

o Create a new variable.


▪ Name: “vNumFormat”
▪ Definition: '#,##0.##'
▪ Description: “Format argument to be applied within the Num() function ”
▪ Tags: “Number format”
o Apply the variable.
▪ Edit the expression for all three of the following visualization elements on the bar
chart:
• Data > Measures > Merchant Totals > Expression
Num(Sum(Amount),$(vNumFormat))
• Appearance > General > Title
'Total Amount: '&Num(Sum(Amount),$(vNumFormat))
• Appearance > General > Subtitle
'Average Transaction Amount: '
&Num(Avg(Amount),$(vNumFormat))
o All numerical labels on the chart should now display a comma as a thousands separator
and two digits to the right of the decimal place.

• Let’s assume that you have changed your mind, and you no longer wish to display digits to the
right of the decimal.

o Edit the vNumFormat variable to reflect the number format argument: '#,##0'

• Examine the impact that this edited variable has had on the numerical values displayed on the
chart. They should all be rounded to whole number values.

© 2023 QlikTech International AB. All rights reserved. All company and/or product names may be trade names, trademarks and/or registered trademarks of the respective
owners with which they are associated.
Exercise Instructions | page 4
Examine an existing variable
• Proceed to the sheet titled: Color codes supplied as variables.
• This sheet shows a bar chart which displays the Year Over Year difference in spending at each
merchant.
o If you examine the properties panel, Data > Measures > Year Over Year Difference >
Expression, you will see that the variable vCompare2014-2013 is applied to calculate the
measure.
o Visit the Variables overview dialog in order to view the expression associated with this
measure. It is a set statement which subtracts the amount spent in 2013 from the
amount spent in 2014.
Mouseover the Definition in order to see the full expression which serves as the definition
for this variable:

Sum({$<Year={2014}>}Amount)-Sum({$<Year={2013}>}Amount)

Use color codes supplied as variables


• Remain on the sheet titled: Color codes supplied as variables.
• Our goal is to color the positive and negative bars as different colors. And, we will store those
hexadecimal color codes as variables so that they can easily be used in other visualizations and
edited later, if required.
o Create a new variable.
▪ Name: “vRed”
▪ Definition: '#C24641'
▪ Description: “Cherry Red color which may also be defined by the RGB color
code (194,70,65)”
▪ Tags: “Custom color”
o Create a new variable.
▪ Name: “vGreen”
▪ Definition: '#54C571'
▪ Description: “Zombie Green color which may also be defined by the RGB
color code (84,197,133)”
▪ Tags: “Custom color”
o Apply the new color variables in a conditional expression.
▪ Appearance > Colors and legend
• Colors – change from Auto to Custom.
• By expression
If($(vCompare2014-2013)>0,$(vGreen),$(vRed))
• Ensure that The expression is a color code checkbox is checked, and
you should see red and green bars on the bar chart.

© 2023 QlikTech International AB. All rights reserved. All company and/or product names may be trade names, trademarks and/or registered trademarks of the respective
owners with which they are associated.
Exercise Instructions | page 5
Use entire expressions supplied as variables
• Proceed to the sheet titled: Entire expressions supplied as variables.
• Here, you are presented with an empty sheet. The goal is to create an entire expression which
can be applied to different locations within a visualization.
o Create a new variable.
▪ Name: “vMyKeyAnalysisElement”
▪ Definition: Avg(Amount)
▪ Description: “This aggregation / expression represents my key analysis
element”
▪ Tags: “Key element”
o Create a new chart to apply the new variable.
▪ Visit the Charts section of the assets panel, and drag & drop a Bar chart onto
the sheet.

▪ Configure the following properties for the bar chart:


Data section
• Data > Dimensions > Add: Purchase Category

• Data > Measures > Add > ( ): $(vMyKeyAnalysisElement)


o Label ( ): ='$(vMyKeyAnalysisElement)'

Add-ons section
• Reference lines > Add reference line
o Reference line expression: =$(vMyKeyAnalysisElement)

Appearance section
• General > Title
='Overall $(vMyKeyAnalysisElement) = '&
$(vMyKeyAnalysisElement)

• Colors and legend


o Colors – change from Auto to Custom

o By measure
$(vMyKeyAnalysisElement)
o Label: “Color scale”

o Color scheme = Sequential gradient

© 2023 QlikTech International AB. All rights reserved. All company and/or product names may be trade names, trademarks and/or registered trademarks of the respective
owners with which they are associated.
Exercise Instructions | page 6
Use entire expressions supplied as variables (cont’d)

• The resulting
visualization should
appear as you see
here:

• Assume that after consulting with a colleague, it is recommended that you evaluate your key
analysis element using a Median, rather than an average.
o Edit the vMyKeyAnalysisElement variable to define the new aggregation within the
expression: Median(Amount)

• Review the change


in values displayed
across all
components of the
visualization.

© 2023 QlikTech International AB. All rights reserved. All company and/or product names may be trade names, trademarks and/or registered trademarks of the respective
owners with which they are associated.
Exercise Instructions | page 7
Use entire expressions supplied as variables (cont’d)

• Note that a Master measure is available within the assets panel of a published app, which may
make it easier for users to apply than variable values. Create a Master measure which uses the
variable as its expression, or a portion of the expression.

o Assets panel > Master items icon > Measures > Create new
▪ Expression ( ): $(vMyKeyAnalysisElement)
▪ Name: “Aggregated Amount”
▪ Label Expression ( ): ='$(vMyKeyAnalysisElement)'

o Drag & drop a new KPI chart type on the sheet.


▪ Add the master measure: Aggregated Amount.

o The resulting visualization should appear as you see here:

© 2023 QlikTech International AB. All rights reserved. All company and/or product names may be trade names, trademarks and/or registered trademarks of the respective
owners with which they are associated.
Exercise Instructions | page 8

You might also like