Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

hammermill21
Contributor II

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
MVP
MVP

Re: Adding Current Moth to Expression

What was the expression you tried?

hammermill21
Contributor II

Re: Adding Current Moth to Expression

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

MVP
MVP

Re: Adding Current Moth to Expression

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
Contributor II

Re: Adding Current Moth to Expression

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?

MVP
MVP

Re: Adding Current Moth to Expression

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