Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
acme
Contributor III
Contributor III

Conditional Calculation

Dear all,

I am newbie in Qlik. I would like to ask a question about set analysis and conditional calculations for different dimensions.

For example,

I have 2 different buildings and each building has energy analyzers to track the main energy inlet and track the consumption points whose data stored in same database. I want to calculate each building's total inlet energy and put the buildings as dimensions (x-axis) and consumptions as measure (y-axis) in a bar chart. 

When I create Master Item  with set analysis for each building (as follows), my problem is not solved when I visulaize the data with any chart. What is the best option to identify the energy analyzers as inlet analyzers and visualize them?

 

Capture.JPG

Code which is not worked when I identify two different Master Items

MasterItem1 = Sum({<[Building Name] = {'Building-A'}, [Analyzer_Name] = {'Energy Analyzer_1'}>} Energy) + 

Sum({<[Building Name] = {'Building-A'}, [Analyzer_Name] = {'Energy Analyzer_2'}>} Energy)

 

MasterITem2 = Sum({<[Building Name] = {'Building-B'}, [Analyzer_Name] = {'Energy Analyzer_3'}>} Energy) + 

Sum({<[Building Name] = {'Building-B'}, [Analyzer_Name] = {'Energy Analyzer_4'}>} Energy) +

Sum({<[Building Name] = {'Building-B'}, [Analyzer_Name] = {'Energy Analyzer_5'}>} Energy)

Labels (2)
1 Reply
Lisa_P
Employee
Employee

I would recommend that in your data model you differentiate between inlet and outlet to make it simpler to do your calculations. 

In your Script, create an extra field, Type and use a condition such as ..

If(Right(Analyzer_Name, 1)<6, 'Inlet', 'Outlet') as Type

This will allow you to use Type in Set analysis to create your measures simpler.