需要默认为最后一个非空白值 [英] Need to default to last nonblank value
问题描述
目前,dax计算是一个简单的SUM,但是我需要默认使用GrandTotal的最后一个非空白值:
At present that dax calculation is a simple SUM, but I need to default to the last non-blank value for the GrandTotal:
例如,不要说明167,它不应设为9:
For example, instead of stating 167, it should not 9:
推荐答案
类似于您提出的其他问题,您可以使用 HASONEVALUE
更改总计的行为。如果您要累加的列名为 Table1 [Value]
,则所需的度量将如下所示:
Similar to the other question you asked, you can use HASONEVALUE
to change the behavior of the Grand Total. If the column you are summing is named Table1[Value]
then the measure you want will look something like this:
LastNonBlankValue =
VAR LastNonBlankDate = CALCULATE(MAX(DimDate[Date]), Table1[Value] > 0)
RETURN IF(HASONEVALUE(DimDate[Date],
SUM(Table1[Value]),
CALCULATE(SUM(Table1[Value]),
ALLSELCTED(DimDate[Date]),
DimDate[Date] = LastNonBlankDate))
这是为了查找最后一个非空白日期,并对该日期进行总计总计。
This is intended to find the last non-blank date, and sum over just that date for the Grand Total.
由于我不知道您的表名和列名或上下文,因此您需要对其进行修改以适合您的特定情况,但是它应该给您尝试什么的想法。
Since I don't know your table and column names or context, you'll need to modify this to suit your particular situation, but it should give you an idea of what to try.
这篇关于需要默认为最后一个非空白值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!