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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Exclude Fields that has Zero Values?

Hi All,

I Have a problem i've been trying to do it, but failed, how do i hide field values that has Zero Values like below:

NamesMonthCustomerTotal VisitsUnique Visits
LeslieJanLebo3491
JohnFebLebo901
JohnMarLebo01
JonasMarJacob391
JonasAprMike01

Ones that are Highlighted in Red.

NB: Total Visits And Unique Visits are My Expressions.

If(RowNo()=0, NoOfRows(TOTAL), Count(DISTINCT Names))               // this is for Unique Visits

=sum(aggr(count(DISTINCT SalesDate),Customer,SalesDate))               // Used for Total Visits

Regards.

5 Replies
pokassov
Specialist
Specialist

Hello!

For Unique Visits:

if([Total Visits]>0,sum(aggr(count(DISTINCT SalesDate),Customer,SalesDate)) ,0)

Not applicable
Author

Hi Thabiso,

the 0 is only showing for you due to your 'unique visits' expression, I'm not sure how you can have a unique visit value but not at least the same value in your totals visits to be honest?

it points to your unique visits expression not really giving the right result. If you change that expression, those rows should drop out for you.

Even if you have to make it relative to the other expression

If([Total Visits]>=1,

If(RowNo()=0, NoOfRows(TOTAL), Count(DISTINCT Names)) 

)

hope that helps

Joe

Not applicable
Author

Hi,

I works but, now my Unique Values are the same as Total Visits as of Unique Values should remain as 1 for all the rows.

Regards

Not applicable
Author

HI Joe,

the code works, but im getting wrong answer for total sum

e.g

CustomerTotal VisitsUnique Visits
71
Lebo21
Lebo51

the answer for Unique Visits remains as 1 it doesn't give me the Total sum of those Unique Values.

i used Straight Table, and if i use Pivot the values changes and they become more,  the Answer becomes 3 on Unique Visits.

Regards.

Not applicable
Author

if you are using a straight table, you could use the 'sum of rows' total option for that expression.

Looking at what you are trying to do though, I would say you are missing some fact fields which would make this much easier for you. Having to use Aggr like that for your visit count, if you had a visit count field in your underlying model, that expression becomes simpler.

If you have an example to upload that would be good, as I am fairly sure changes can be made to the model to make this easier for you

Joe