0

I'm trying to transform my clasic formula to a dynamic array one, but i can't

My current working classic formula is

=LET(
per; B4;    
data; FILTER(CHOOSE({1\2}; Taula1[Cap];Taula1[Cap]*Taula1[Tipo]); Taula1[Per]=per);    
res; SUM(INDEX(data;;2)) / SUM(INDEX(data;;1) );
res)

But it doesn't run when i'm trying to transform the formula changing the parameter to a dynamic array B4#

Now I copy/paste the classic formula to next rows

The result must be:

Final image

And source data was:

Source data

1
  • 1
    Not sure may be something like this would work: =LET( per, B4#, data, FILTER(CHOOSE({1,2,3}, Taula1[Per],Taula1[Cap],Taula1[Cap]*Taula1[Tipo]), ISNUMBER(XMATCH(Taula1[Per],per))), uniq,UNIQUE(INDEX(data,,1)), rowwise,BYROW(uniq,LAMBDA(x,SUM(--(x=INDEX(data,,1))*(INDEX(data,,3)))/SUM(--(x=INDEX(data,,1))*(INDEX(data,,2))))), HSTACK(uniq,rowwise)) Commented Aug 27, 2023 at 13:39

1 Answer 1

1

Excelent !!!

=LET(per; B4#;
     rowwise; BYROW(per; LAMBDA(x; SUM(--(x=Taula1[Per])*(Taula1[Cap])*(Taula1[Tipo]) ) / SUM(--(x=Taula1[Per])*(Taula1[Cap])) ));
     res; HSTACK(per; rowwise);
     res)

I didn't have enough experience with BYROW function

Thanks a lot

Sign up to request clarification or add additional context in comments.

1 Comment

This really nice, i was thinking about making it short, but due to very less information i was not able to think more, also you had not responded in the mean time, ok, since you have resolved it ensure to accept your own answer so it helps someone in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.