Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Read about the latest Qlik Community enhancements on the Community News blog!
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

Create a measure built on a filter

Hi Everybody,

I am struggling with formats of expressions in Qlik.

I have a column 'total in' which gives me the number of all entries in busses for 5 month.

My KPI gives me the correct sum. Then I put filter of total in and select 0 in order to get the number of times when nobody

was in the bus. In order to show the difference, I wanted to use alternate state and create a measure where the Total in is 0 

in order to have the same result as using the filter. Unfortunately, all syntax are 'garbage'.

In general, all numbers / dates which can be selected in filters could be incorporated as dimension / measure, but I dont

know how to write those expressions....

In my Total in = 0 as a measure, does anybody have an idea how this could be done easily?

Thanks a lot,

2 Replies

I doubt, But this will give a clue?

If(GetSelectedCount(Filed)>0, Sum(TotalIn), Sum({AlternateState<Field=>}0)*1)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor II
Contributor II

Hi Anil,

Thanks for taking the time to solve my issue, as I said before I am not a specialist with expressions, maybe I can help someone else with an easier alternative.

Once you filtered on the total in an chose 0, you go back to creating measure and select your alternate state, chose the table + total in and you can simply click on 'set expression' and the measure I wanted magically appears.

This is also very helpful with dates, etc.

Greetings from Luxembourg

Since it worked for me, hopefully someone else gets the 'aha' moment as well.