Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jason_nicholas
Creator II
Creator II

Building charts with static selection- Detatch or Set Analysis

I have done some digging into my issue, and I have found many solutions which describe Set Analysis (and which I have had a hard time following) and a few others which discuss the Detatch function. I would appreciate a review of my use case and some insight on how best to proceed.

I'm building a function to analyze support bookings, and I am trying to make the end result as user-friendly and click-less as possible. I've worked my way through much of the LOAD work, and now I need to develop the required displays. My question comes in two parts. I'll put part 2 in the comments to keep organized.

Part 1

I have a bar chart using the dimensions  MONTH and REGION and an expression of COUNT(DISTINCT([Booking ID]))

this results in two bars per month (North America and Europe), each counting the number of Booking IDs which fit a set of selections. I would like this result to display in a chart without having to make the selections, and the result should ignore of any selections made.

to make it work now, I select the option "Dedicated" from the field [Charge Type], "Active" from the field [Status], and two other selections in separate fields (lets say "AAA" from [Field1] and "BBB" from [Field2]). This limits my data to exactly the total I want.

It seems Set Analysis might be the solution, but I don't fully understand the syntax in the examples I have read. If this is the way to go, please help me understand the expression required.

Otherwise, I could set the chart as I need it and then choose "Detatch". This may well be the solution, but I am unsure if this data will update as I reload my data set each month. The selections will always remain the same, but the number of DISTINCT([Booking ID]) will increase as new data is added. Can I rely on Detatch to handle this?

23 Replies
sunny_talwar

So even when you added a parenthesis in the end, it gave you the error?

=Only({1} [Booking Date]) >= MonthStart(Max({1} TOTAL [Booking Date]), -1) and
  Only({1} [Booking Date]) <= MonthEnd(Max({1}TOTAL [Booking Date]))

jason_nicholas
Creator II
Creator II
Author

correct. I added an additional ) at the end to both versions, but still resolved to the error.

sunny_talwar

Sorry for dragging this discussion, but what both version? Are we talking about this or something else?

Dimension -> Booking Date

Expression -> =Only({1} [Booking Date]) >= MonthStart(Max({1} TOTAL [Booking Date]), -1) and Only({1} [Booking Date]) <= MonthEnd(Max({1}TOTAL [Booking Date]))

jason_nicholas
Creator II
Creator II
Author

I'm sorry for the confusion. I incorrectly referenced where the error occurred. In the process of trying to clarify, I tried everything again and it all works. I must have had a copy/paste issue the first time around. Here is where I stand:

Your example table is generating -1 results for the dates just as expected. 

This is where I previously received the ") expected" error

The two solution options you provided: the p([Booking Date]) and $::([Booking Date]) variations; are both generating the correct results. I will have to work with them a bit to see which is most effective in my solution

Previously, I encountered a different error here-but mistakenly referred to the error above. No error now, though.

The ultimate solution using $ instead of 1 as the operator at the front is actually the one that I want. I want to be able to make other selections to cull the data, without having to make these 4 selections every time.

I was initially confused about it because I understand $ to indicate all selections should be accounted for. But after looking at it for a bit, I understand it considers all selections EXCEPT the ones specifically called out. that is going to be key for me, because I will need to build similar expressions like this for other charts.

Once again, thanks for all of the help. This has been the most informative and valuable resource I have ever worked with, and in turn, it is solving a major data issue in my office. I'll take this and keep diving deeper. I am sure I'll need a few more threads to finalize, but this is really turning out to be an amazing tool.