cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HugoCExtA Frequent Visitor
Frequent Visitor

Group by specific condition

Hello,

 

I have a table that I'd like to group by with a specific condition, the condition is : each time there is a 1 in a colum I'd like to group until there is another 1 in the same column. (Not sure it is very clear so I made a picture of what I'd like).

 

Capture.JPG

 

I'm not even sure it is possible with Power BI, but still any advice would be nice.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Group by specific condition

In the query editor just add an index column first. Then multiply that with Type. Replace 0 by null and fill down values.

That will allocate the same number to each row in the group but a different number per group.

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




2 REPLIES 2
Super User
Super User

Re: Group by specific condition

In the query editor just add an index column first. Then multiply that with Type. Replace 0 by null and fill down values.

That will allocate the same number to each row in the group but a different number per group.

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




HugoCExtA Frequent Visitor
Frequent Visitor

Re: Group by specific condition

Thanks, it worked ! Did not know the fill function Smiley Happy

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 40 members 1,023 guests
Please welcome our newest community members: