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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
osama_ayoub
Helper III
Helper III

How can Split group of row into some of subsets based on condition?

I have a Table as below 

this table has some items and quantity and price columns 

what I want to do is divide these items to groups where the total sum of  net price for each group does not exceed 2000$ ?

 

osama_ayoub_1-1674558375857.png

 

 

1 REPLY 1
wdx223_Daniel
Super User
Super User

you can try this code, but the efficiency is a problem

NewStep=let a=Table.AddIndexColumn(PreviousStepName,"idx"),b=List.Buffer(a[Net Value]) in Table.Group(a,"idx",{"n",each _},0,(x,y)=>Byte.From(List.Sum(List.Range(b,x,y-x+1))>=2000))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.