Forum Discussion
Filter Function or any Logic
Does the M code in the sample file return the intended output? I've created sample data since i don't have access to your file.
No OliverScheurich​ , the data also we need to calculate, attached is the sheet again, Worksheet home is the actual data,
1st Col-K we need to calculate for each rnti:-
As an example, I just created a sheet for rnti==9400, and created the data for it(Col-K and M)
then output like below can be easily be populated
which , I need for all rnti's in the home tab.
- OliverScheurichNov 18, 2025Gold Contributor
I've found your sample file in an earlier thread. However there is only one rnti in your sample file that is 384. I've attached your sample file "Filter_Function.xlsx" with suggested code.
For my sample data there are now 2 queries as shown in the screenshot. One query returns the final output and the other query shows the intermediary step that includes the "spdu-" column. My sample file is "Filter Function or any Logic.xlsx".
- m_tarlerNov 18, 2025Bronze Contributor
so the file is still not attached (at least I can't see it). please share using a cloud option like onedrive or google drive. I think I get it. See the attached file. I have 2 output options, the first is:
=LET(rnti,data[rnti],ack,data[clrCtrl], same,--DROP(VSTACK(ack,-1)=VSTACK(-1,ack),-1), counts, SCAN(0,same,LAMBDA(p,q,(p+q)*q)), countsB, IF(counts>6,6,counts), PIVOTBY(rnti,"spcu-"&countsB,countsB,COUNT))but this one has spcu-0 column and total columns and row (which I thought might be helpful)
but this will take those things away:
=LET(rnti,data[rnti],ack,data[clrCtrl], same,--DROP(VSTACK(ack,-1)=VSTACK(-1,ack),-1), counts,SCAN(0,same,LAMBDA(p,q,(p+q)*q)), countsB,IF(counts>6,6,counts), tabl,PIVOTBY(rnti,"spcu-"&countsB,countsB,COUNT,0,0,,0), HSTACK(TAKE(tabl,,1),DROP(tabl,,2)))- anupambit1797Nov 18, 2025Iron Contributor
Hi Everyone, I am trying this for the 1st time( to share a file via Google Drive)
https://docs.google.com/spreadsheets/d/1nKNKhXTLyUJC32v6oegsjFUMBiKXzaCN/edit?pli=1&gid=1146938509#gid=1146938509
Let me know if this is accessible.
Br,
Anupam
- LorenzoNov 19, 2025Silver Contributor
Very good idea. The HLINK works but we can't access the file.
When sharing it you should grant read rights - at least