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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Girish_123
Helper I
Helper I

group the value wherever is break

Hi Team, I have a one column want to create new column problem is whenereve there is value other than one make it in a new group 
how to achive the result in power query or dax calculation below is sample input column and output column
Input Column               Output Column
1                                          G1
1                                          G1
1                                          G1
1                                          G1
23                                        G2
1                                          G2
1                                          G2
12                                        G3
1                                          G3
1                                         G3
1                                          G3
43                                         G4
1                                           G4

2 REPLIES 2
AlienSx
Super User
Super User

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    g = Table.Group(Source, "Input Column", {{"all", each _}}, GroupKind.Local, (s, c) => Number.From(c <> 1)),
    idx = Table.AddIndexColumn(g, "Output Column", 1, 1),
    prefix = Table.TransformColumns(idx, {"Output Column", each "G" & Text.From(_)}),
    r = Table.RemoveColumns(prefix,{"Input Column"}),
    e = Table.ExpandTableColumn(r, "all", {"Input Column"})
in
    e
ToddChitt
Super User
Super User

Try this in Power Query:

Add a Custom Column with a formula like this:

if [input column] = 1 then null else [input column]

Now do a FILL DOWN operation on this column. Note that the first group G1 may be NULL so you may also have to do a REPLACE VALUES and replace NULL with some unique string or number.

Next do a GROUP BY of this column




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.