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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Evan0211
Creator II
Creator II

Need to show only the negative values in a bar chart

I am calculating the difference between two dates and need to graph on a bar chart only the dates that have a value less than 0 (these are the dates that were not delivered by the need by date)

To calculate the difference, I am doing this:

Sum(Date([Projected Need Date]) - Date([DeliveryDate])

I have set up a bar chart with the dimension [ID] and the measure  is Sum(Date([Projected Need Date]) - Date([DeliveryDate]).

This shows me a graph of all of the date differences, both positive, negative, and zero (arrived on the need by date).  What I need to show is only the negatives.  Any ideas?

Labels (1)
1 Solution

Accepted Solutions
Anil_Babu_Samineni

Perhaps this?

Sum({<ID={"=Len(Sum(Date([Projected Need Date]) - Date([DeliveryDate]))<=0"}>}Date([Projected Need Date]) - Date([DeliveryDate])

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

3 Replies
Anil_Babu_Samineni

Perhaps this?

Sum({<ID={"=Len(Sum(Date([Projected Need Date]) - Date([DeliveryDate]))<=0"}>}Date([Projected Need Date]) - Date([DeliveryDate])

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
Evan0211
Creator II
Creator II
Author

In my expression for the ID dimension, I have updated the code to this but it says it is invalid, though the expression shows as OK

=if(


Sum(Date([Projected Need Date]) - Date([Delivery Date])) <0

,[ID])

In my head, this would only show the IDs that have a result less than 0 but it is not working.

Anil_Babu_Samineni

Aggregated data not allowed in dimension, Instead you can try this

=if(


Aggr(Sum(Date([Projected Need Date]) - Date([Delivery Date])),ID) <0

,[ID])

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