Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
NR001
New Member

DECLARE Cursor in Fabric

Anyone know how DECLARE CURSOR works in Fabric? Is it not supported at all?

3 REPLIES 3
NaveenUpadhye
Frequent Visitor

It supports in fabric script activities.

Shahid12523
Community Champion
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.

Shahed Shaikh
Anonymous
Not 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.

 

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Free Fabric Certifications

Free Fabric Certifications

Get Fabric certified for free! Don't miss your chance.

January Fabric Update Carousel

Fabric Monthly Update - January 2026

Check out the January 2026 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.