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

Use an expression for month, quarter, year counts

I want to re-use one expression for counts per:

Month, Quarter and Year.

Hence, when the user filters on one month, the year count should not be affected. It still should show the overall Year count.

Instead of using several expressions, I would like to re-use my expression, but i'm not sure how to do that

What needs to be modified on the below example expression in order to be used for these kind of purposes?:

=Count( {<[City]={1}>} Distinct Fact.ID)

4 Replies
sunny_talwar

You want to use the same expression, but ignore different filters for different expression? Not sure if that is possible

twanqlik
Creator
Creator
Author

Yes exactly.

I want them to use for Year, Month and Quarter KPI's.

When the user filters on months, the month KPI should change, but it shouldn't affect the Year KPI.

Hence, when the user selects 2 months, the Year KPI should still be calculated over the complete year (12 months) and not over 2 months.

arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Twan,

I think you need to nully those fields where they need not to affect.

like below: Year KPI

=Count( {<[City]={1},months=>} Distinct Fact.ID)


Thanks,

Arvind Patil

sunny_talwar

Is this expression part of a variable? If it is, you can try something like this

vVar = Count( {<[City]={1}, $1>} Distinct Fact.ID)

$(vVar(month)) -> month KPI

$(vVar(Year)) -> Year KP

...

I am using this technique here

Variables with Parameters