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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
acbishop2
Creator
Creator

If statement condition not calculating

Can someone tell me why this isn't working?

Count(If(Floor([Date]) >= FirstWorkDate(Max([Date]),5),[Id]))

[Date] is a field that holds a date (duh). [Id] is the primary key of the table. Essentially, I am just trying to find out how many records have a specific date between 5 business days ago and now. 

When I break it down, it seems like it should work:

  • Max([Date]) = 7/28/2019.   This is correct.
  • FirstWorkDate(Max([Date]),5) = 7/22/2019.   This is also correct.

Yet when I try the whole formula, I get an undefined value ("-").

I did* try changing the Max([Date]) to RangeMax([Date]), but that ends up returning a value that's way too high.

I also tried creating a variable for FirstWorkDate(Max([Date]),5), then including it in the original formula, but that gives me a nested aggregation error.

I appreciate the help in advance.

Labels (3)
1 Reply
Lisa_P
Employee
Employee

Try re-arranging this :

If(Floor([Date]) >= FirstWorkDate(Max([Date]),5),Count([Id]), 0)