如何将Qliksense的最新月份限制为最新月份?

发布于 2025-02-06 12:18:57 字数 645 浏览 2 评论 0 原文

我正在尝试创建一个只有当月数据的线图。我的日期字段称为购买的。我还将其用于仪表板上的“日期范围选择器”小部件。我的尺寸是购买的,我的度量是 publicvolume 。我的数据看起来像这样:

”在此处输入图像描述”

我如何设置一个条件以仅使用当前/最新月份的台表?

我尝试使用这样的变量:
curressMonth = max(puferataedate)

,我将行图中的表达式设置为:
尺寸: if(Curstralth,购买)
测量:如果(CurressMonth,pupluevolume)

但是在这里,我的价值观根据日期Ranger Picker的选定日期不断变化。我如何仅设置最新月份的线条图(因此,尺寸将在最近一个月的每一天,在这种情况下是2022年1月)?有什么方法可以设置计算条件?

I'm trying to create a line chart with the data for only the current month. My date field is called PurchaseDate. I use this also for the 'Date Range Picker' widget in my dashboard. My dimension is PurchaseDate and my measure is PurchaseVolume. My data looks like this:

enter image description here

How can I set a condition to use only the current/latest month for my line chart?

I tried using a variable like this:
CurrentMonth = Max(PurchaseDate)

And I set the expression in my line chart to:
Dimension: if(CurrentMonth, PurchaseDate)
Measure: if(CurrentMonth, PurchaseVolume)

But here, my values keep changing according to the selected date on the Date Ranger Picker. How can I set the line chart for only the latest month (so the dimension will have each day of the latest month, which in this case will be Jan 2022) independent of the Date Range Picker? Is there a way I can set the calculation condition?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

<逆流佳人身旁 2025-02-13 12:18:57

您可以在表达式中使用集合分析来过滤购买的(s), montrystart monthend> monthend> monthend 最大月份:

sum({&lt; (= montrystart(max({1} puferatedate))))&lt; = $(= monthend(max({1} puferaseatedate)))“}&gt;} puplyVolume)

有趣的路径是设置分析:

< = {“

  • 代码>购买 (max({1}购买)将返回最大可能的日期的开始日期
  • 的结束日期
  • 月末(max({1}购买)将返回最大可能日期 code> {1} monthstart monthend 函数是 忽略所有可能的选择

结果表是:

在两个日期之间具有的月末字段

替代方案是在表中(或日历表中的另一个字段,如果存在)。该字段将与每个日期关联,并代表日期的月份。例如:

“表观视图”

在这种情况下,表达式将是:

sum({&lt; pupperaseedate =,puchasemonth = {“ $(= max({1} puplasemonth))”}&gt;} puplyVolume)

puferacateate = 最初是为了忽略购买的所有选择字段)

,两个表的结果将相同:

//i.sstatic.net/rs3eg.png“ rel =“ nofollow noreferrer”>

RawData:
Load
  *,
  MonthEnd(PurchaseDate) as PurchaseMonth
;
Load * Inline [
PurchaseDate, PurchaseVolume
11/01/2022  , 100
12/01/2022  , 101
13/01/2022  , 102
14/01/2022  , 103
01/02/2022  , 104
02/02/2022  , 105
03/02/2022  , 106
04/02/2022  , 107
01/05/2022  , 108
02/05/2022  , 109
03/05/2022  , 110
04/05/2022  , 111
];

You can use set analysis in your expression to filter PurchaseDate(s) which are between the MonthStart and MonthEnd of the max possible month:

Sum({<PurchaseDate={">=$(=Monthstart(max({1}PurchaseDate)))<=$(=monthend(max({1}PurchaseDate)))"} >} PurchaseVolume)

The interesting path is the set analysis:

PurchaseDate={">=$(=MonthStart(max({1}PurchaseDate)))<=$(=MonthEnd(max({1}PurchaseDate)))"}

  • Monthstart(max({1}PurchaseDate) will return the start date of the max possible date
  • MonthEnd(max({1}PurchaseDate) will return the end date of the max possible date
  • the {1} before MonthStart and MonthEnd functions is to ignore all possible selections when calculating

The result table is:

Between dates

Having month end field

Alternative of between two dates is to have another field in the table (or in the calendar table, if exists). This field will be associated with each date and will represent the month of the date. For example:

table view

In this case the expression will be:

Sum({<PurchaseDate=, PurchaseMonth={"$(=max({1}PurchaseMonth))"}>} PurchaseVolume)

(PurchaseDate= is to initially to ignore all selections in PurchaseDate field)

And the result of both tables will be the same:

all tables

For the record, my script is:

RawData:
Load
  *,
  MonthEnd(PurchaseDate) as PurchaseMonth
;
Load * Inline [
PurchaseDate, PurchaseVolume
11/01/2022  , 100
12/01/2022  , 101
13/01/2022  , 102
14/01/2022  , 103
01/02/2022  , 104
02/02/2022  , 105
03/02/2022  , 106
04/02/2022  , 107
01/05/2022  , 108
02/05/2022  , 109
03/05/2022  , 110
04/05/2022  , 111
];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文