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

Formula error

Good day,

I need help.

I want to calculate our Rental Contracts Maintenance Costs.

The costs Lies in out General Ledger. In this table we have a field name: Narrative.

In this Narrative I want the sum of my formula to exclude any entries with FK Mnthly-MAINT-23.

[The 23 at the end indicate how many months this rental has been running].

Thus, it should sum all the enties values, except the values with a Narrative FK Mnthly-MAINT...

I am using the following formula:

 

sum(if(left(Narrative,16)<>'FK Mnthly-MAINT-',Value)) , but it looks like it is still pulling through the values with this Narrative.

Please advice if my formula is incorrect, and what the correct manner will be?

Thank you

*R*


3 Replies
Not applicable
Author

The Narrative field must be aggregated somehow, like all the fields in expressions in qlikview. You can do it with the Only function:

sum(if(left(Trim(Only(Narrative)),16)<>'FK Mnthly-MAINT-',Value))


Anyway, It would be much better (for performance) to create a new field in the script to check what you want.

Not applicable
Author

Hi there,

If I try that formula, it gives me zero value.

But in my Edit Expression Window it shows that there is an error in Expression:

expression.jpg

Not applicable
Author

Sorry Rentia, I didn't realize that you can't trim after the only function, it would be better to try it this way:

sum(if(left(Trim(Narrative),16)<>'FK Mnthly-MAINT-',Value))