Qlik Sense App Development

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for
Did you mean:
Highlighted
Contributor III

How to get a percentage only on a selected fields (not null cases)

Hi

With reference to above subject, I am trying below formula in expressions but getting "Error in Expression".

(Sum(if(Levels = 'Level*', (Gross),'NA'))) / (sum((if(Levels = 'Level*', total (Gross),'NA'))))

Please see the above and help me to identify where I am making mistake.

Abhijit ARANKALLE.

1 Solution

Accepted Solutions
Highlighted

Perhaps this?

Alt(Sum({<Levels = {'Level*'}>} Gross)/Sum({<Levels = {'Level*'}>} TOTAL Gross), 'NA')

Or, For me this is suffice

Alt(Sum({<Levels = {'Level*'}>} Gross)/Sum(TOTAL Gross), 'NA')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
11 Replies
Highlighted

Perhaps this?

Alt(Sum({<Levels = {'Level*'}>} Gross)/Sum({<Levels = {'Level*'}>} TOTAL Gross), 'NA')

Or, For me this is suffice

Alt(Sum({<Levels = {'Level*'}>} Gross)/Sum(TOTAL Gross), 'NA')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
Contributor III

Hi

Thanks a lot for your response. It working fine in total but when I am adding quarter fields in pivot - column, then I am getting incorrect results by quarter.

Thanks and Regards,

Abhijit ARANKALLE.

Highlighted
Contributor III
Only when there is only one dimension as Level. When you have a Quarter or Month dimension in column, then results are not perfect.
Highlighted
MVP
I see you already have a thread... would you be able to provide a sample with the issue and what you expect to see as the output from the sample provided?
Highlighted
Contributor III

Hi

Please see attached. The red one is current result and green colour is I am expecting.

Thanks and regards,

Abhijit ARANKALLE.

Highlighted
MVP

Try this

Sum(Gross)/Sum(TOTAL <EncDate.YearQuarter> Gross)
Highlighted
Contributor III

Hi

I tried this but it is taking percentage for NULL values also.

Highlighted
MVP
percentages for NULL values? really? Can you share a screenshot to show what you mean?
Highlighted
Contributor III

Hi

Please see attached file for details.

Thanks and Regards,

Abhijit ARANKALLE.