如何在 Qlik Sense 中将筛选面板显示为下拉菜单?

huangapple go评论138阅读模式
英文:

How do I make a filter pane appear as a Drop down menu in Qlik Sense?

问题

我是初学者,正在使用 Qlik Sense Desktop 制作一个面板,希望它尽可能地与另一个面板相似。我试图模仿的面板似乎有一个下拉菜单形式的筛选面板选项。下面的图像显示了我试图模仿的内容,文字是葡萄牙语,取自这里,在单击"Visão Geral"之后:

如何在 Qlik Sense 中将筛选面板显示为下拉菜单?

我知道我可以创建一个高度为一磁贴的筛选面板。这种方式下,字段名称将被显示,用户点击后将显示值。但如果可能的话,我想要更接近图中显示的效果。我尝试按照这篇帖子建议安装了 Vizlib 库,但筛选器样式仍然相同。

如何在 Qlik Sense 中使筛选面板显示为下拉菜单?提前感谢。

英文:

I am a beginner using Qlik Sense Desktop to make a panel which (ideally) should be as similar as possible to another panel. The panel I am trying to mimic has an option of what I believe to be a filter pane presented as a drop down menu. The figure below (the texts are in Portuguese) shows what I am trying to mimic, and was taken from here, after you click in "Visão Geral":

如何在 Qlik Sense 中将筛选面板显示为下拉菜单?

I know I have the option of creating a filter pane one tile high. This way, the field name would be displayed and when the user click it the values will be shown. However, if possible, I would like something closer to what was shown in the Figure. I tried installing Vizlib library as suggested in this post, but the filter style remains the same.

How can I make a filter pane appear as a Drop down menu in Qlik Sense? Thanks in advance.

答案1

得分: 1

你可以使用变量输入对象、一个变量Concat()函数集合分析的组合来实现这个目标。

基本思路是,Variable Input对象将以下拉模式显示,其中包含[Setor]字段的所有可用值的列表,选择其中一个值将更新我们的变量,该变量将在我们希望使用此下拉列表影响的每个图表度量中扩展为一个集合表达式。

步骤1:创建一个名为vDropdown的新变量,并将默认值设置为Todos

如何在 Qlik Sense 中将筛选面板显示为下拉菜单?

步骤2:在您的工作表中添加一个新的Variable Input对象。

变量选项卡下,从列表中选择我们的新变量,然后选择下拉选项。

选项卡下,选择动态选项。在下面的框中,添加以下表达式:

='*~Todos|' & Concat(all distinct [Setor] & '~' & [Setor], '|')

这是这个表达式的作用:

  • *~Todos| 部分使用星号作为通配符字符,作为底层值,以及单词Todos作为显示值。星号通配符字符在我们进行集合分析步骤时将对我们很有用。
  • Concat(all distinct [Setor] & '~' & [Setor], '|') 部分使用Concat()函数将所有不同的[Setor]值与管道字符|分隔开。波浪线字符~在这里用于将底层值与显示值分隔开(这只在我们首次操作时真正重要)。

步骤3:在您想要受下拉列表影响的图表度量中添加集合表达式。

使用以下表达式:

{<[Setor]={"$(=Coalesce(EmptyIsNull('$(vDropdown)'), '*'))"}>}

因此,您可以这样使用它:

=Sum({<[Setor]={"$(=Coalesce(EmptyIsNull('$(vDropdown)'), '*'))"}>} [Processos])

在这里,我们在集合表达式内部使用了我们的vDropdown变量。基本上,它的作用是将[Setor]字段设置为下拉列表中选择的任何内容,除非我们的变量为NULL,在这种情况下,它只返回一个星号*。这对我们很有用,因为当您在集合分析中使用星号(就像这样 &quot;*&quot;)时,您基本上是告诉Qlik返回“所有非NULL值”。

这应该足以使它正常工作:

如何在 Qlik Sense 中将筛选面板显示为下拉菜单?

英文:

You can use a combination of the Variable Input object, a variable, the Concat() function, and Set Analysis to achieve this.

The basic idea is that the Variable Input object will be in Dropdown mode with a list of all the available values of the [Setor] field, the selection of which will update our variable, which will be expanded in a set expression in each chart measure that we want to affect with this dropdown.

Step 1: Create a new variable called vDropdown and set the default value to Todos.

如何在 Qlik Sense 中将筛选面板显示为下拉菜单?

Step 2: Add a new Variable Input object to your sheet.

Under the Variable tab, choose our new variable from the list, then select the Dropdown option.

Under the Values tab, choose the Dynamic option. In the box below it, add this expression:

=&#39;*~Todos|&#39; &amp; Concat(all distinct [Setor] &amp; &#39;~&#39; &amp; [Setor], &#39;|&#39;)

Here's what this is doing:

  • The *~Todos| part is using the asterisk as the wildcard character as the underlying value and the word Todos as the displayed value. The asterisk wildcard character will be useful to us when we get to the set analysis step.
  • The Concat(all distinct [Setor] &amp; &#39;~&#39; &amp; [Setor], &#39;|&#39;) part is using the Concat() function to combine the all of the distinct values of [Setor] separated with the pipe character |. The tilde character ~ is used here to separate the underlying values with the displayed values (this only really matters with the first thing we did).

Step 3: Add the set expression to the chart measures that you want to be affected by the dropdown.

Use this expression:

{&lt;[Setor]={&quot;$(=Coalesce(EmptyIsNull(&#39;$(vDropdown)&#39;), &#39;*&#39;))&quot;}&gt;}

So you would use it like this:

=Sum({&lt;[Setor]={&quot;$(=Coalesce(EmptyIsNull(&#39;$(vDropdown)&#39;), &#39;*&#39;))&quot;}&gt;} [Processos])

Here we are using our vDropdown variable inside of a set expression. Basically what it's doing is to set the [Setor] field to whatever is selected in our dropdown unless our variable is NULL, in which case it just returns an asterisk *. This works for us because when you use an asterisk in set analysis (like this --> &quot;*&quot;) then you're basically telling Qlik to return "all non-NULL values."

That should be enough to make it work:

如何在 Qlik Sense 中将筛选面板显示为下拉菜单?

huangapple
  • 本文由 发表于 2023年6月6日 04:35:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76409826.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定