Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Sasik
Contributor II
Contributor II

Issue related to zero values in the bar chart

Hi All,

I have a bar chart where I need to add Saturday and Sunday values to Friday bar. And Saturday and Sunday bars should not be displayed on the chart. Please find the below example. 

I have an inline load code as below.

load * Inline [
Date, Count
31/08/2020, 0
01/09/2020, 10
02/09/2020, 20
03/09/2020, 30
04/09/2020, 10
05/09/2020, 10
06/09/2020, 10
]

Here the dates 31st Aug to 6th Sep represent Monday to Sunday.

When I developed a bar chart out of this code 'Date' as dimension and 'Count' as measure the chart display as below.

Sasik_0-1602576401368.png

 

When I try to add Saturday and Sunday values to Friday bar (5th and 6th values added to 4th) the chart looks like below.

 

Sasik_1-1602576401384.png

Expression used:
if( rowno()<=4, sum(Count),
     if(rowno()=5, RangeSum(below(sum(Count),0,3)))
     )

But I need to display the values only from Monday to Friday. If I use ‘Supress zero values’ option in Presentation tab, then I am missing Monday value also as below (31st Aug missing which is a zero value).

Sasik_2-1602576401387.png

In this scenario how can I get Monday to Friday values only though there are zero values for any bar. Please help.

 

Regards

SasiK

 

 

1 Solution

Accepted Solutions
Sasik
Contributor II
Contributor II
Author

I could find the answer for this by changing the expression to below.


if( rowno()<=4, if(sum(Count)=0, '',sum(Count)) ,

if(rowno()=5, RangeSum(below(sum(Count),0,3)))
)

Sasik_0-1602671008162.png

 

Regards

SasiK

View solution in original post

1 Reply
Sasik
Contributor II
Contributor II
Author

I could find the answer for this by changing the expression to below.


if( rowno()<=4, if(sum(Count)=0, '',sum(Count)) ,

if(rowno()=5, RangeSum(below(sum(Count),0,3)))
)

Sasik_0-1602671008162.png

 

Regards

SasiK