第一次发布,但我不知所措。

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

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

https://social.msdn.microsoft.com/Forums/sqlserver/zh-CN/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)

  ask by Evan translate from so

本文未有回复,本站智能推荐: