Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
hosasahana
Partner - Contributor III
Partner - Contributor III

nested if else logic help in qliksense

hi all,

Request help in nested if for a qlik logic I have.

I have 3 tables loaded , each table has a type of device in it. 

I want to take a count of device in each table divided by total count of devices from all 3 tables, including few other where clauses.

A:

id

deviceA 

date

calculated measure  

date 

 

B:

id

deviceB 

date

calculated measure  

date 

 

C:

id

deviceC

date

calculated measure  

date 

how can I get below output?

I want output like

if date  <today()) count(date)       (individual device count A/B/C)        count(ID)3 tables        (individual device count) /count(ID)

 

regards,

Sahana

1 Reply
QFabian
Specialist III
Specialist III

Hi @hosasahana , please see if this works for you and if it is what you want theorically, it is always preferible to make things on script, before trying to do everything in expressions.

It is a concatenation of that three tables :

A:
Load
id,
deviceA as Device,
DateField,
CalculatedMeasure
From yoursource;

concatenate
Load
id,
deviceB as Device,
DateField,
CalculatedMeasure
From yoursource;

concatenate
Load
id,
deviceC as Device,
DateField,
CalculatedMeasure
From yoursource;

Then, makes 2 tables to get the results about dates :

Not_Today:
Load
Device,
count(date) as Not_Today_Count
from A
Where
DateField < today()
Group By
Device;

Today:
Load
Device,
count(date) as Today_Count
from A
Where
DateField >= today()
Group By
Device;

then you can make a formula like this  in your chart, using Device as dimension:

sum(Not_Today_Count) / sum ( total Today_Count)

QFabian