Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

qlikview - Filtering by a calculated measure involving multiple fields in Qlik Sense

I am trying to use a calculated measure as a way to filter my data, but it's looking more difficult than expected. Let me explain through an example.

I have data of the following type, with two dimensions - one is a unique ID, the other a category - and four measures.

Initial table

My first step is to rank each element by its score, where the ranking is evaluated within the same category. I therefore create a new measure:

=aggr(rank(sum(Score1)), Category, UniqueID)

I do this for all three scores, resulting in three new calculated measures. My final calculated measure is the average of the three rankings. Below the example, the calculated measure of interest is the one in bold. Note that in my real world calculation I directly evaluate 'New Measure', without creating the intermediate columns 'RankingScore'.

Data with newly calculated measure

Note that this measure is tricky, as it changes according to previous selections. Say, for instance, that I select only entries with 'Amount' > 1000. The relative rankings will change and therefore also 'New Measure'.

In my actual App I need to filter my entries by 'New Measure', after I've done some previous selections on fields like 'Amount'. If it simply were a field, I would normally have created a filter pane, our used the qsVariable extension to have a slide range, to select only rows with 'New Measure' above a set threshold. Unfortunately it seems I cannot do that with my calculated measure.

How would you approach the problem? I was wondering, for example, if it were possible to 'convert' my new measure to an actual field, after all previous selections have been done, but perhaps this is nonsense.

Thank you in advance, and apologies for the long post!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If I'm understanding correctly, I believe this solution should work:

  1. Create a variable for your slider: new_measure_slider.
  2. Create a New Sheet Object -> Slider/Calendar Object.
  3. Configure your slider to control your new new_measure_slider variable.
  4. Create a calculated dimension in your chart substituting your 'New Measure' formula (the one you stated was an average of the three ranks). It should be a conditional like this: =if(aggr([your average formula here], Category, UniqueID) >= new_measure_slider, [Category], null()). Basically, compare your formula to the new_measure_slider variable. If true, use the Category (or UniqueID, whichever you need) as the dimension, if false, null().
  5. Check the 'Suppress When Value is Null' checkbox on your new dimension. This is key. This is what will actually filter your chart.
  6. In the chart properties, Presentation tab, click on your new calculated dimension and hit 'Hide Column'. We don't need to see this because we are using it only as a filter.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...