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: 
BogdanT18
Contributor III
Contributor III

Measure result is 0 but if I apply a filter it works

This is the expression:

if(match(Source,'AAA',
'BBB','CCC'),

//then
Num (
Sum(
Aggr( Sum(TOTAL <Year, Month>{<Source={'AAAA'}>} Value)
*
Sum(TOTAL <Year, Month>{<Source={'DDD'}, Help={'EEE'}>} Value) , Year,Month )
)
/
Sum(TOTAL <Year, Month>{<Source={'DDD'}, Help={'EEE'}>} Value)

,'0.0%')

)

 

If I filter Source with value AAA it shows me the expected result, without this it's 0 and not working.

Any ideas why ? Thank you 🙂

Labels (3)
4 Replies
ogster1974
Partner - Master II
Partner - Master II

When using match the result will be as follows for match(Source,'AAA',
'BBB','CCC')

Nothing selected in filter. = -

AAA selected in filter. = 1

BBB selected in filter. = 2

CCC selected in filter. = 3

DDD selected in filter. = 0

 

 

BogdanT18
Contributor III
Contributor III
Author

OK, and what should I modify/add in order to see the result without any filter applied? I want to add that I also tried with pick match functions and it had the same behavior. Thanks 🙂

ogster1974
Partner - Master II
Partner - Master II

Well your current measure is all hard coded so removing your if statement will just run your measure excluding any filters on the fields set in your measure.

Without some examples of data and what you expect the result to be its hard to advise on a suitable solution.

I would try breaking out your measure components into smaller measures so you can track what's happening when filters are applied. It will help you to understand what's going on with your data.

vinieme12
Champion III
Champion III

That's because you have specified it to be 0 if nothing is selected

Match() can only match A SINGLE VALUE, which means you are forcing a selection to be made

 

if(match(Source,'AAA','BBB','CCC'),    < <  if any of these are selected 

//then
Num (
Sum(
Aggr( Sum(TOTAL <Year, Month>{<Source={'AAAA'}>} Value)
*
Sum(TOTAL <Year, Month>{<Source={'DDD'}, Help={'EEE'}>} Value) , Year,Month )
)
/
Sum(TOTAL <Year, Month>{<Source={'DDD'}, Help={'EEE'}>} Value)

,'0.0%'     <<CURRENTLY if nothing is selected then return 0     << ADD YOUR EXPRESSION HERE instead of 0.0%

)

)

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.