通过Qlik Sense中涉及多个字段的计算得出的度量进行过滤 [英] Filtering by a calculated measure involving multiple fields in Qlik Sense

查看:958
本文介绍了通过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.

我有以下类型的数据,具有两个维度-一个是唯一的ID,另一个是类别-和四个度量.

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

初始表格

我的第一步是根据每个元素的得分对它们进行排名,在同一类别中对排名进行评估.因此,我创建了一个新的度量标准:

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)

我对所有三个分数都执行此操作,从而得出三个新的计算量度.我最终计算出的指标是三个排名的平均值.在示例下面,计算出的兴趣指标为粗体.请注意,在我的实际计算中,我直接评估了新度量",而没有创建中间列"RankingScore".

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'.

具有新计算的度量的数据

请注意,此度量很棘手,因为它会根据先前的选择而更改.例如,假设我只选择金额"> 1000的条目.相对排名将发生变化,因此也会更改新度量".

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'.

在我的实际应用中,我对金额"等字段进行了一些先前的选择后,需要通过新度量"来过滤我的条目.如果只是一个字段,我通常会创建一个过滤器窗格,我们使用 qsVariable 扩展名具有幻灯片范围,仅选择新度量"高于设置阈值的行.不幸的是,我似乎无法用自己的计算方法做到这一点.

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!

推荐答案

如果我正确理解,我认为此解决方案应该有效:

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

  1. 为滑块创建一个变量:new_measure_slider.
  2. 创建一个新的图纸对象->滑块/日历对象.
  3. 配置滑块以控制新的new_measure_slider变量.
  4. 在图表中创建一个计算维,用新度量"公式代替(您所说的是三个等级的平均值).它应该是这样的条件: =if(aggr([your average formula here], Category, UniqueID) >= new_measure_slider, [Category], null()). 基本上,将您的公式与new_measure_slider变量进行比较.如果为true,则使用Category(或您需要的唯一ID)作为维度;如果为false,则使用null().
  5. 选中新维度上的当值为空时抑制"复选框.这是关键.这实际上将过滤您的图表.
  6. 在图表属性的演示"选项卡中,单击新的计算尺寸,然后单击隐藏列".我们不需要看到它,因为我们仅将其用作过滤器.
  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.

这篇关于通过Qlik Sense中涉及多个字段的计算得出的度量进行过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆