动态计算的列在不同的报告级别SSAS DAX查询

发布于 2025-02-01 11:10:06 字数 390 浏览 3 评论 0原文

我正在尝试根据SSAS Cube中的派生度量来创建一个计算出的列,该措施将计算每个订单的案例数,因此,如果它具有3个案例,则它将具有3个案例。

现在我正在尝试要创建一个库属性,其中1 caseorder,2caseorder,3caseorder,3+caseorder。我尝试了以下一个

if([[nrofcase] = 1,“ nrofcase [1]”,if([nrofcase] = 2,“ nrofcase [2]”, 如果([[nrofcase] = 3,“ nrofcase [3]”,“ nrofcase [> 3]”)

但它无法正常工作,当报告的级别从QTR更改为一周时,重新计算不同的水平。

请让我知道是否有效。

I'm trying to create a calculated column based on a derived measure in SSAS cube, this measure which will count the number of cases per order so for one order if it has 3 cases it will have the value 3.

Now I'm trying to create a bucket attribute which says 1caseOrder,2caseOrder,3caseOrder,3+caseOrder. I tried the below one

IF([nrofcase] = 1, "nrofcase[1]", IF([nrofcase] = 2, "nrofcase[2]",
IF([nrofcase] = 3, "nrofcase[3]", "nrofcase[>3]") )

But it doesn't work as expected, when the level of the report is changed from qtr to week it was suppose to recalculate on different level.

Please let me know if it case work.

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

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

发布评论

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

评论(1

梦里°也失望 2025-02-08 11:10:06

计算的列是静态的。当添加列以及处理表时,计算和存储值时。价值更改的唯一方法是重新处理模型。如果公式指的是DAX度量,则它将使用该措施而无需报告的任何上下文(例如,没有行过滤器或切片机等)。

这样想:

  • 计算的列是关于一行不会改变的事实。仅通过看一行就知道它。一个例子是成本= [数量] * [单位价格]。成本永远不会改变,并通过查看数量和单价列而知道。报告中是什么过滤器或上下文都没关系。成本不会改变。
  • 措施是关于桌子的事实。您必须查看多行才能计算其值。一个示例是总成本= sum(销售[成本])。您希望此值根据时间,区域,产品等的不同而更改,因此它的值不是存储的,而是在报告中动态计算。

听起来您的数据,有多行告诉您每个订单的案例数,因此这是一个措施。使用度量代替计算的列。

Calculated columns are static. When the column is added and when the table is processed, the value is calculated and stored. The only way for the value to change is to reprocess the model. If the formula refers to a DAX measure, it will use the measure without any of the context from the report (eg. no row filters or slicers, etc.).

Think of it this way:

  • Calculated column is a fact about a row that doesn't change. It is known just by looking at a single row. An example of this is Cost = [Quantity] * [Unit Price]. Cost never changes and is known by looking at the Quantity and Unit Price columns. It doesn't matter what filters or context are in the report. Cost doesn't change.
  • A measure is a fact about a table. You have to look at multiple rows to calculate its value. An example is Total Cost = SUM(Sales[Cost]). You want this value to change depending on the context of time, region, product, etc., so it's value is not stored but calculated dynamically in the report.

It sounds like for your data, there are multiple rows that tell you the number of cases per order, so this is a measure. Use a measure instead of a calculated column.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文