Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
sunil2288
Creator III
Creator III

Checking an expression against a Substring Value

Hi Everyone,

After a long period having some problem while developing finance analysis.

Actually i have a model where there is a field named "HFM_Code"which is having values like 'P0300000-Sales expenditure' which are string value . i need to calculate the sum(amount) incurred against the HFM_Code='P0300000' only.

How to resolve this ....

Reply appreciated

Thanks

Suneel

3 Replies
Or
MVP
MVP

Assuming the code and text description are always separated by a dash, you should be able to use the following:

left(HFM_Code,Index(HFM_Code,'-')-1)


If this isn't what you meant, please post sample data / expected result or a sample QVW.

johnw
Champion III
Champion III

If I understood the question, in the script:

subfield(HFM_Code,'-',1) as HFM_Code_Group

Then where you want to do the sum:

sum({<HFM_Code_Group={'P0300000'}>} amount)

sunil2288
Creator III
Creator III
Author

Wow John.....

You understood my problem well and solved it quite comfortably.

Thank you very much