Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set expression not working as intended

I have the following expression in a chart, which members here told me would only show data from the past 7 weeks


sum({<[Paid in full date]={">=$(=Date(Today()-7))<=$(=Date(Today()-1))"},[Customer] = >}

date([Paid in full date])

-

date([Invoice date])

) / Count( {<[Paid in full date]={">=$(=Date(Today()-7))<=$(=Date(Today()-1))"},[Customer] = >}Count)

However, I want to test with data in the last 6 days, so I replaced the 7 with a 6, but nothing appeared.

Here are my dates

date.png

Any ideas?

1 Solution

Accepted Solutions
sunny_talwar

Paid in full date = Invoice date between 6/14/2017 and 6/19/2017 making the numerator = 0

Capture.PNG

View solution in original post

21 Replies
vishsaggi
Champion III
Champion III

May be try this:

One small suggestions do not ever use the native QV functions names as your column names. Just want to confirm the one colored in red below is that your Field name Count can you rename that field QV thinks that as a native function. I would not use any native function names as my field names.

Try this:

= sum({<[Paid in full date]={">=$(=Date(Today()-7, , 'MM/DD/YY'))<=$(=Date(Today()-1, 'MM/DD/YY'))"},[Customer]= >} date([Paid in full date]) - date([Invoice date]))/

Count({<[Paid in full date]={">=$(=Date(Today()-7, , 'MM/DD/YY'))<=$(=Date(Today()-1, , 'MM/DD/YY'))"},[Customer]= >} Count)

sunny_talwar

so I replaced the 7 with a 6, but nothing appeared.


What do you mean here? what did not appear? Can you share a sample?

Not applicable
Author

Okay I have changed my Count table to Payment_count.

I implemented the change you suggested, but now it looks the same as my chart with

sum({<[Customer] = >}

date([Paid in full date])

-

date([Invoice date])

)/ Count( {< [Customer] = >}Payment_count)

which is the original without any date constraints

vishsaggi
Champion III
Champion III

OK, so you still have the issue? With your first expression?

Not applicable
Author

Right, it now seems to show all data regardless of date.

Is there something wrong with my syntax? Are the Date and Today supposed to be blue?

code.png

Not applicable
Author

Using a line chart, it says no data to display. But there should be, because as you can see in my date range, there is data from 5 to 6 days ago.

sunny_talwar

Dates are visible, yes. But do you have count (or new Payment_count) associated with all dates? May be the rest of the 6 days have null count?

vishsaggi
Champion III
Champion III

You have an extra comma in the Date. It should be like

">=$(=Date(Today() -5, 'MM/DD/YY'))

My bad.

May be use this?

= sum({<[Paid in full date]={">=$(=Date(Today()-7, 'MM/DD/YY'))<=$(=Date(Today()-1, 'MM/DD/YY'))"},[Customer]= >} date([Paid in full date]) - date([Invoice date]))/

Count({<[Paid in full date]={">=$(=Date(Today()-7, 'MM/DD/YY'))<=$(=Date(Today()-1,  'MM/DD/YY'))"},[Customer]= >} Payment_Count)

Not applicable
Author

I just checked, and Payment Count is associated with everything. Payment count is just a count of all the records in my data file, so it is associated with literally everything in my data set