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

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
Anil_Babu_Samineni

I doubt, But this will give a clue?

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

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Romainscho1
Contributor III
Contributor III
Author

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.