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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
MHarrell
Contributor II
Contributor II

Creating Date Range flags in the data load editor

Hello,

How would I use the inmonth or inquarter function within the data load editor to flag patients that came in to our hospitals.  I use them regularly in set analysis but I can't figure out how to do the same function with an if() statement to create a yes or no flag.  Here's an example of my set analysis.  In this case I'm getting total visits from two months prior than my variable date.  Is there a better way to do this than the inmonth or inquarter functions?  I need it all to be dynamic based on the date that's being pulled in from vCurrentDateCutoff.

sum({<AdmitDate={"=inmonth(AdmitDate,Date(vCurrentDateCutoff, 'M/D/YY'),-2)='-1'"}>}Visits)

I also need to create a single dimension that has various date ranges to replicate our general ledger.  Example would be that I need to put a dimension in a pivot table that would give me the last four quarters and last six months broken out individually.  What is the best way to do this?

Thanks for your help!

1 Solution

Accepted Solutions
Lauri
Specialist
Specialist

I would expect this to work in a load script:

Load

AdmitDate,

If(inmonth(AdmitDate,Date(vCurrentDateCutoff, 'M/D/YY'),-2), 'yes', 'no') as Flag2monthsago

...

View solution in original post

2 Replies
Lauri
Specialist
Specialist

I would expect this to work in a load script:

Load

AdmitDate,

If(inmonth(AdmitDate,Date(vCurrentDateCutoff, 'M/D/YY'),-2), 'yes', 'no') as Flag2monthsago

...

MHarrell
Contributor II
Contributor II
Author

Thank you this worked.  I thought I had tried this but must have missed something the first time.  I did have to make a small change to the variable to get it to work properly '$(vCurrentDateCutoff)'.

Thanks for your help!

Matt