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: 
Anonymous
Not applicable

Using if statement in KPI object

Hi guys,

in a KPI object I want to show the total amount of accounts that we've prepaid.

This means, that I want to show the total sum of a measure if this is > 0.

I tried the following script:

if(SUM({<[Outstanding invoices flag AP]={'y'}>}[Remaining Amount AP])>0,SUM({<[Outstanding invoices flag AP]={'y'}>}[Remaining Amount AP]))

Unfortunately, the KPI object only shows a minus sign as outcome.

When I'm using a table with the vendor name and the outstanding invoices flag as dimensions, the measure expression written below works.

if(sum([Remaining Amount AP]) > 0, sum([Remaining Amount AP]) )

How should I convert the total amount from the table into a KPI object?

Your help is much appreciated!

Mike

EDIT: I've attached an example Excel file with vendors, status and remaining amount. Hopefully this helps.

12 Replies
woshua5550
Creator III
Creator III

then you may need to check your data set

if my expression showing 0 ,that means there is no values when [Outstanding invoices flag AP] is 'y' and [Remaining Amount AP]>0

plz notice that qlik is case sensitive so that 'y' is not equals 'Y'

you can attach your data and qvw file if possible

Anonymous
Not applicable
Author

Hi Andrea,

when making the example file in Excel and reading your comment, I've realised that the Flag was not 'y' but 'Outstanding'.. Very stupid mistake, sorry about that! The aggr function did the job for me! Thanks a lot:)

Anonymous
Not applicable
Author

Hi Dave,

as I've said already to Andrea in the comment above, I made a stupid mistake within the flag. The proper value wasn't 'y' but 'Outstanding'. Sorry about that!

Although, the expression you proposed shows the total amount off all the positive amounts.

It is therefore, in my case, I should use the aggr function to get the proper total amount, which shows the total amount > 0 per vendor!

Thanks a lot for your help and I was able to clarify the case