将嵌套函数从Excel转换为PowerPivot

时间:2016-05-24 18:02:10

标签: excel powerpivot

第一次发帖,但我的智慧结束了。

我有一个大约有8,000行的工作簿,但是它被几个包含嵌套条件语句的字段所困扰。 (sumifs,averageifs,countifs)因此,尝试迁移到PowerPivot,但没有使用PowerPivot的经验。在

找到类似的SUMIFS转换

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b50f7b74-d459-4033-954e-53158f900334/excel-sumifs-and-the-powerpivot-version-help-please?forum=sqlkjpowerpivotforexcel

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/49e77cb7-b7c3-4eb1-85ed-963e5cce8e64/vlookup-and-countifs-in-powerpivot?forum=sqlkjpowerpivotforexcel

但是嵌套功能似乎让我感到沮丧。花了一天的前半天,到目前为止,这是我所拥有的最好的。请救我自己。谢谢!

IFERROR(
IF([Savings_TYPE]="[E]",

IF(OR([Savings_DATE]<NOW()-30,
      Calculate(Sum([Realized Savings]),ALL(PMO_TEST_View_1,[Project_ID_FK],[Savings_DATE]>0)),
      Calculate(Sum([Realized Savings]),ALL(PMO_TEST_View_1,[Project_ID_FK],[Savings_DATE]))),

IF(OR([Current_Status]="complete",
      [Current_Status]="Cancelled",
      [Current_Status]="on hold",
      [Current_Status]="delete"),0,

IF(AND(
   IFERROR(
   Calculate(average([Realized Savings]),[Project_ID_FK],[Savings_DATE]>=NOW()-100,[Savings_DATE]<NOW())=0,0),
   Calculate(COUNTROWS(([Discounted Savings]),Filter(PMO_TEST_View_1,[Discounted Savings]=EARLIER([Project_ID_FK]&&[Savings_DATE]>=NOW()-100,[Savings_DATE]<NOW())>1),0,
   MIN([Discounted Savings],
   IFERROR(Calculate(average([Realized Savings],ALL([Project_ID_FK],[Savings_DATE]>=NOW()-100,[Savings_DATE]<NOW(),[Realized Savings]<>0)),1000000000))))),0),0)

以下内容已在Excel中有效。

=IFERROR(
   IF([@[Savings_TYPE]]="[E]",
   IF(OR([@[Savings_DATE]]<NOW()-30,
         SUMIFS([Realized Savings],[Project_ID_FK],[@[Project_ID_FK]],[Savings_DATE],[@[Savings_DATE]])>0),
         SUMIFS([Realized Savings],[Project_ID_FK],[@[Project_ID_FK]],[Savings_DATE],[@[Savings_DATE]]),

   IF(OR([@[Current_Status]]="complete",
         [@[Current_Status]]="Cancelled",
         [@[Current_Status]]="on hold",
         [@[Current_Status]]="delete"),0,

   IF(AND(
      IFERROR(AVERAGEIFS([Realized Savings],[Project_ID_FK],[@[Project_ID_FK]],[Savings_DATE],">="&NOW()-100,[Savings_DATE],"<"&NOW())=0,0),
      COUNTIFS([Discounted Savings],">0",[Project_ID_FK],[@[Project_ID_FK]],[Savings_DATE],">="&NOW()-100,[Savings_DATE],"<"&NOW())>1),
      0,MIN([@[Discounted Savings]],
      IFERROR(AVERAGEIFS([Realized Savings],[Project_ID_FK],[@[Project_ID_FK]],[Savings_DATE],">="&NOW()-100,[Savings_DATE],"<"&NOW(),[Realized Savings],"<>0"),1000000000))))),0),0)

0 个答案:

没有答案