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: 
hammermill21
Creator III
Creator III

Adding Current Moth to Expression

Hello,

I currently have an inventory count :

IF(Building= 'UMHC - BASCOM PALMER EYE INSTITUTE', Count(DISTINCT Barcode), Barcode)

Which works fine but it's doubling because this inventory has a monthly and a quarterly inventory, so I think my solution is to add to the expression to count only for the current month's inventory but each time I try I get an error. I tried adding Month = {"$(=MaxString(Month))"} to the expression but that doesn't seem to work.

Any ideas? Thanks!

5 Replies
sunny_talwar
MVP
MVP

What was the expression you tried?

hammermill21
Creator III
Creator III
Author

IF(Building= 'UMHC - BASCOM PALMER EYE INSTITUTE', Month = {"$(=MaxString(Month))"} Count(DISTINCT Barcode), Barcode)

sunny_talwar
MVP
MVP

If statement's syntax is different then set analysis syntax . Not entirely sure I understand what you have and what you want, but try this

If(Building= 'UMHC - BASCOM PALMER EYE INSTITUTE', Count(DISTINCT {<Month = {"$(=MaxString(Month))"}>} Barcode), Barcode)

hammermill21
Creator III
Creator III
Author

Hey Sunny,

I see what you are saying but that's nothing working. What I'm trying to do is if the Building = UMHC - BASCOM PALMER EYE INSTITUTE and the month = the current month then to count the distinct barcodes. Make sense?

sunny_talwar
MVP
MVP

Current Month or Max month? May be this

If(Building= 'UMHC - BASCOM PALMER EYE INSTITUTE' and Month = Month(Today()), Count(DISTINCT Barcode), Barcode)

assuming Month is created in the script like this

Month(Date) as Month