Forum Discussion
DECLARE Cursor in Fabric
Anyone know how DECLARE CURSOR works in Fabric? Is it not supported at all?
3 Replies
- AnonymousNot applicable
Hallo The fabric toolbox contains many options and tricks manipulate data and to create cursor like functions. It depends on your situation, skills and the type of cursor you are looking for.
I see several options. To name a few: If you want to calculate a value , per group. You can alway´s use DAX and PowerBI within Fabric.
For example:
_previous value PREVIOUSDAY = CALCULATE ( SUM ( MyTable[Value] ), FILTER ( MyTable, MyTable[Date] = PREVIOUSDAY ( LASTDATE ( ALLSELECTED ( MyTable[Date] ) ) ) ) )
The result can be exported via the Powerautomate ´visual´ to almost any sink.
Another way is to create a query in powerquery m.
Grouping in Power Query; Getting The Last Item in Each Group - RADACAD
A third way would be to use a notebook. python - Assign Last Value of DataFrame Group to All Entries of That Group - Stack Overflow
Another option is the goodold Data factory (my personal favorite). Create wome aggregate activities to feed a warehouse or lakehouse.
There are probaly many more options i forgot.
Good luck.
- Shahid12523
Community Champion
DECLARE CURSOR is not supported in Microsoft Fabric.
Use set-based queries (JOIN, CTE, MERGE, window functions) or Fabric components (Dataflows/Notebooks) instead. - NaveenUpadhye
Advocate I
It supports in fabric script activities.