Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis to select all months in Quarter

I have a requirement to display all values falling within the quarter when any month within the quarter is selected in filters.  So if the user selects the month of May, they should see sales from all of Q2.  Can anyone help me adjust the syntax of the below (or provide an alternate solution if necessary)?

sum({<SaleQtr = p({<SaleMonth = {$(=GetFieldSelections(SaleMonth))}>} SaleQtr)>} sale_amount)

I have tried several variations on the above with no success so far.

Thanks

1 Solution

Accepted Solutions
Not applicable
Author

Thanks, but after much more trial and error, I have come up with the solution - sort of similar to your suggestion.

I created a variable using =concat(SaleQtr,',') to make a list of possible quarters, then use that in the set analysis:

{<SaleQtr = {$(=$(vSaleQtrs))}, SaleMonth = >}

This produces the desired result.

View solution in original post

9 Replies
sunny_talwar

May be this:

Sum({<SaleQtr = p(SaleQtr), SaleMonth>} sale_amount)

fcecconi
Partner - Creator III
Partner - Creator III

Ashley

I use a master calendar and set a QTD flag based on a date in the calendar table.  It will get refreshed with each load.

I use -InQuarterToDate(Datum, Today(),0) as CQTD_Flag,

Datum is autogenerated date.

Hope this helps

Not applicable
Author

Sorry, that doesn't appear to be valid syntax for set analysis, and I can't quite figure out what you're suggesting well enough to adjust it.

Not applicable
Author

I think i see what you're suggesting here, but my need is for it to be dynamic based on the user selection.  If the user selects August, I need it to show all of Q3, if they select Feb, it should show Q1, etc.  Or is there a way to adapt your suggestion to what I'm looking for?  Sorry if I'm just not seeing it.

sunny_talwar

I am suggesting to ignore the selection made in SaleMonth field, but because of the selection made in SaleMonth we would have made a indirect selection in SaleQtr. So take everything for the SaleQtr (SaleQtr = p(SaleQtr)) part.

Not applicable
Author

Thanks, but after much more trial and error, I have come up with the solution - sort of similar to your suggestion.

I created a variable using =concat(SaleQtr,',') to make a list of possible quarters, then use that in the set analysis:

{<SaleQtr = {$(=$(vSaleQtrs))}, SaleMonth = >}

This produces the desired result.

sunny_talwar

Glad you did, but I would suggest you to at least try it out once. I find p() to be a cleaner way of doing it + you might learn something new .

Best,

Sunny

Not applicable
Author

Thanks, I did try the p() route in every possible configuration i could think of but it did not produce the desired behavior in my app.

sunny_talwar

Here is an example to look at

Capture.PNG