DAX获取帐户名输入的最新日期 [英] DAX to get latest date of an account name entry

查看:434
本文介绍了DAX获取帐户名输入的最新日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了类似的报告问题,但到目前为止,没有一种解决方案有效。如果我输入的信息有误,请通知我。

I have found similar reported questions, but none of the solutions have worked so far. If I am entering the information incorrectly, please let me know.

我在Power Pivot中有一个表,其中包含重复的名称,以及输入的日期和名称。我想做的是获取名称的最新输入日期。

I have a table in Power Pivot that contains repeated names, and dates entered that go with the names. What I am trying to do is get the latest date entered for a name.

示例:

Name | Date       | Latest Date
A    | 6/24/2016  |
A    | 6/24/2017  |
A    | 6/24/2018  |
B    | 7/05/2010  |
B    | 7/05/2011  |
C    | 6/8/2009   |
C    | 6/8/2010   |
C    | 6/8/2011   |

我希望在最新日期下拥有与名称相对应的最新日期。它应如下所示:

What I would like under Latest Date is to have the latest date that corresponds to the Name. It should look like the following:

Name | Date       | Latest Date
A    | 6/24/2016  | 6/24/2018
A    | 6/24/2017  | 6/24/2018
A    | 6/24/2018  | 6/24/2018
B    | 7/05/2010  | 7/5/2011
B    | 7/05/2011  | 7/5/2011 
C    | 6/8/2009   | 6/8/2011 
C    | 6/8/2010   | 6/8/2011 
C    | 6/8/2011   | 6/8/2011 

我尝试使用以下功能,但我得到的只是#错误(当然会根据文件中的数据更改表引用)

I've tried to use the following function, but all I keep getting are #Errors (of course changing the table reference based on the data in the file)

= CALCULATE(
      MAX(Table1[Date]);
      FILTER(Table1;
          Table1[ID] = EARLIER(Table1[ID])
      )
  )

如果以上功能正确,我想知道我做错了什么。 ()中的哪个值是列引用,哪个是单元格引用?

If the above function is correct, I wonder what I am doing wrong. Which one of the values in the () are column references and which ones are cell references? Perhaps that's where I am going wrong.

任何帮助都是非常感激的。我试图尽可能好地输入信息,以便为您提供帮助。

Any assistance is very appreciative. I tried to enter the information as nicely as possible so it can be assisted.

推荐答案

DAX中没有单元格或行引用。一切都由过滤器完成。

There are no cell or row references in DAX. Everything is done with filters.

尝试使用最新日期

= CALCULATE(
      MAX(Table1[Date]);
      FILTER(ALL(Table1);
          Table1[Name] = EARLIER(Table1[Name])
      )
  )

给一个镜头作为好吧,如果那不能解决问题:

Give this a shot as well if that doesn't do the trick:

= CALCULATE(
      MAX(Table1[Date]);
      ALLEXCEPT(Table1; Table1[Name])
  )

这篇关于DAX获取帐户名输入的最新日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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