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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
0li5a3a
Creator III
Creator III

Legend wrong

hI all.

I need to display in a Bar Cart the total number of the tickets for the last 30 days.I have a field named Severity where I have something like this Severity = S1, S2, S3, S4, S5,etc.

I want to display only the data for the last 30 days for a specific customer and I want to display the days without tickets too.

like below.

Dimensions :

Day

and

= IF( Customer LIKE 'xxx', Severity)

Expressions:

count({< Date = {"<=$(=DATE(MAX(Date)))>=$(=DATE(MAX(Date)-30))"}>}TICKETID)

and

sum(1) I use this to display all the dates with no data so this is blank.

I the below chart the data is selected ok only the problem is with the legend  because I can see all the Severities, there suppose to be just the severities for the last 30 days but in may example are all for example S1 which is from 2 months ago.

Could someone please advise ?

Capture.PNG

1 Solution

Accepted Solutions
Anil_Babu_Samineni

The, You could mandatory to use Master Calendar to generate missing dates

Master:

LOAD TICKETID, Customer, Severity, OrderDate

FROM [Test samples xlsx.xlsx]

(ooxml, embedded labels, table is Sheet1);

Calendar_Table:

LOAD

    Date(OrderDate) AS OrderDate,

    Year(OrderDate) AS Year,

    'Q' & Ceil(Month(OrderDate) / 3) AS Quarter,   

    Month(OrderDate) As Month,

    Day(OrderDate) As Day,

    Week(OrderDate) As Week;

Load Date(MinDate + IterNo() -1 ) AS OrderDate While (MinDate + IterNo() - 1) <= Num(MaxDate);

Load

    Min(OrderDate) AS MinDate,

    Max(OrderDate) AS MaxDate

RESIDENT Master;

Note - Calendar_Table not mandatory to carry all fields. You can continue with OrderDate alone for this case. It's upon you

Then, Create tabular table and follow the same

Use dimension as Day and Calc. Dimension for Customer

Expression is same but from presentation tab you must Un-Check the Zero counts for X-Axis scale

HTH

Anil

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

21 Replies
Anil_Babu_Samineni

May be try this for Dimension

= IF( Match(Customer, 'xxx'), Severity)


OR Using Set analysis

count({< Date = {">=$(=DATE(MAX(Date)-30)) <=$(=DATE(MAX(Date)))"}, Customer = {xxx}>}TICKETID)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
0li5a3a
Creator III
Creator III
Author

Hi Anil, I tried but this doesn't works in my case:(. Thanks

Anil_Babu_Samineni

This, Doesn't for you?

count({< Date = {">=$(=DATE(MAX(Date-30))) <=$(=DATE(MAX(Date)))"}>}TICKETID)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
0li5a3a
Creator III
Creator III
Author

I tried to add it to the expression and no results. I think , I need to restrict the dimension in some way... for the last 30 day... and  maybe this would works.   The problem  when I restrict the data for the last 30 days I loose all the days with no data.

Anil_Babu_Samineni

Usually, I don't prefer to use calculated dimension , Any way

Can you show image where you did?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
0li5a3a
Creator III
Creator III
Author

Capture.PNG

0li5a3a
Creator III
Creator III
Author

Capture.PNG

0li5a3a
Creator III
Creator III
Author

and here I changed the dimension day to be op_date and I enable the second expression  which was SUM(1) to display the null.

After I do all the above I can see that the legend now shows right but I need to see the dates with don't contains any tickets

Capture.PNG

Anil_Babu_Samineni

This won't help to me. Will you provide sample? Instead xxx you could use your Value

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful