Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show Chart X Axis Values With Non Null Values

Hi,

I get from my database purchases amount and their date (dd/mm/yyyy), in the SQL I add a field named Month (Date_Format(Date),'%m') as Month)

and I have added an inline like this:

YearNames:

LOAD * INLINE [

    Month, Month Name

    01, January

    02, February

    03, March

    04, April

    05, May

    06, June

    07, July

    08, August

    09, September

    10, October

    11, November

    12, December

];

In my charts the dimension is [Month Name] to make it more readable, the problem is that all of the months show up (from January to December) even if i have data only for a couple of months .

How can I solve this? (preferably in the chart and not in the script)

Attached is a simplified case of my problem.

Thanks!

By the way, I can't suppress 0 values because some of my inputs might be 0.

EDIT:

I've tried a different approach inspired by tresesc's comment:

I do need both the date and the month name from the DB, and I want to be able to choose by date, week number, month name and quarter so I did the following:

in the select statement for the actual data, one of the things I selected was:

DATE_FORMAT(DateColumn, '%d/%m/%Y') AS Date

And at then I've added a new select:

SELECT DISTINCT

    DATE_FORMAT(DateColumn, '%d/%m/%Y') AS Date,

    DATE_FORMAT(DateColumn, '%m') AS Month,

    MONTHNAME(DateColumn) AS 'Month Name',

    QUARTER(DateColumn) AS Quarter,

    YEAR(DateColumn) AS Year,

    CONCAT('W', DATE_FORMAT(DateColumn, '%u')) AS weekNum

FROM

    DB

It solved the current problem where months that are not in the data but are in the inline appear, but it had created a new one: now the chart shows the following

Capture.PNG.png
where the last indicator is '-' (null).

What can I do about it?

Thanks!

1 Solution

Accepted Solutions
tresesco
MVP
MVP

In the dimensions tab, check 'Supress When Value is Null'.

View solution in original post

9 Replies
ashfaq_haseeb
Champion III
Champion III

like this

Have a look at calculated Dimension

=if(Amount>=0,[Month Name])

Regards

ASHFAQ

tresesco
MVP
MVP

If you are only bothered about getting the monthnames, better option would be like:

Screen Shot 09-30-14 at 01.15 PM.PNG.png

Note: You can set the MonthNames variables to get the full names as well.

PrashantSangle

Hi,

Try this with calculated Dimension

if(len(trim(Amount))>0,[Month Name])

or

if(not isnull(Amount),[Month Name])

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
ashfaq_haseeb
Champion III
Champion III

Hi,

Can you close this thread by selecting appropriate answers.

Regards

ASHFAQ

Not applicable
Author

Hi,

Not yet, I am currently trying to implement the suggestions you've given, but it has some problem i'm trying to fix.

I'll make sure to close the tread when the problem is solved.

Thanks!

PrashantSangle

Hi,

When you add calculated dimension.

After that check supress when value is null.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Thanks,

I've tried a different approach inspired by your comment:

I do need both the date and the month name from the DB, and I want to be able to choose by date, week number, month name and quarter so I did the following:

in the select statement for the actual data, one of the things I selected was:

DATE_FORMAT(DateColumn, '%d/%m/%Y') AS Date

And at then I've added a new select:

SELECT DISTINCT

    DATE_FORMAT(DateColumn, '%d/%m/%Y') AS Date,

    DATE_FORMAT(DateColumn, '%m') AS Month,

    MONTHNAME(DateColumn) AS 'Month Name',

    QUARTER(DateColumn) AS Quarter,

    YEAR(DateColumn) AS Year,

    CONCAT('W', DATE_FORMAT(DateColumn, '%u')) AS weekNum

FROM

    DB

It solved the current problem where months that are not in the data but are in the inline appear, but it had created a new one: now the chart shows the following

Capture.PNG.png
where the last indicator is '-' (null).

What can I do about it?

Thanks!

tresesco
MVP
MVP

In the dimensions tab, check 'Supress When Value is Null'.

PrashantSangle

Hi,

Did you try my reply.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂