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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
data_RN
Creator
Creator

SUM IF question - using InQuarter

Hello All, 

I hope I have an easy one for you 🙂  I am hoping I am simply overthinking it...

I am trying to get a sum of the amount of products that have a launch date this quarter.  I have been able to flag the products as the dates being in the is quarter using:

InQuarter([Launch Date],Today(),0)

Product GroupProductLaunch DateThis Quarter
   -4
Fruitapples12/31/20180
Fruitbananas1/15/20190
Vegetablesbeet4/20/2019-1
Vegetablescarrot4/1/2019-1
Fruitoranges5/1/2019-1
Vegetablesturnip5/25/2019-1


But what I really want is  to show the number of Products Launching THIS quarter by Product group.  I know this is wrong, but something like this:

=SUM(if([Launch Date] = InQuarter,Today(),[Product Group]))

Product GroupThis Quarter
Total4
Fruit1
Vegetables3

 

Thanks in advance!

2 Solutions

Accepted Solutions
sunny_talwar

If you don't have a flag, than may be this

 

Count({<[Launch Date] = {"=InQuarter([Launch Date],Today(),0)"}>}[Launch Date])

 

View solution in original post

Anonymous
Not applicable

use a straight table with Dimension "Product Group" and Expression:

aggr(sum(if (InQuarter([Launch Date],Today(),0)=-1,1)),[Product Group])

and Show total and you get your desired output

View solution in original post

6 Replies
marcus_sommer

If you have this flag within the data you could use something like:

count({< [This Quarter] = {-1}>} Product)

- Marcus

sunny_talwar

If you don't have a flag, than may be this

 

Count({<[Launch Date] = {"=InQuarter([Launch Date],Today(),0)"}>}[Launch Date])

 

Anonymous
Not applicable

use a straight table with Dimension "Product Group" and Expression:

aggr(sum(if (InQuarter([Launch Date],Today(),0)=-1,1)),[Product Group])

and Show total and you get your desired output

data_RN
Creator
Creator
Author

Thanks Marcus, 

I get an error - "Error in set modifier ad hoc element list".

Attached is a screenshot.  

'This Quarter' is using:   InQuarter([Launch Date],Today(),0)

Is there something wrong with the 'This Quarter' expression that is creating the error?

data_RN
Creator
Creator
Author

Thank you Sunny!

Indeed that works perfectly!  I had tried SO many iterations of the syntax and I was completely missing the "" in the brackets.

Cheers and Happy Friday!

data_RN
Creator
Creator
Author

Thank you Hrlinder!

Indeed this works too and the syntax isn't as complicated.  

Cheers!