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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
joc
Helper I
Helper I

Replace values with condition

Hello everybody,

 

I need your help again for a problem. IF the rows have the same NAME and MONTH and IF one of thoses rows have a date, I would like all of thoses rows have the same date.

 

I hope, I'm understandable... It's more easier with tables :

 

I have this table :

fig1.jpg

 

 

And I would like this table :

fig2.jpg

 

Thank in advance for the help,

Joc

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@joc

 

Hi, You can do it in Query Editor:

 

Sort By Name (Ascending)

Sort By Month (Ascending)

Sort by Month_V2 (Descending)

 

Next Step is Select Month_V2 Column and Select Transform - Fill Down

 

 




Lima - Peru

View solution in original post

3 REPLIES 3
Vvelarde
Community Champion
Community Champion

@joc

 

Hi, You can do it in Query Editor:

 

Sort By Name (Ascending)

Sort By Month (Ascending)

Sort by Month_V2 (Descending)

 

Next Step is Select Month_V2 Column and Select Transform - Fill Down

 

 




Lima - Peru

Thank you for the help !

My suggestion would be also a Power Query solution, using Group By:

 

let
    Source = Table1,
    #"Grouped Rows" = Table.Group(Source, {"NAME", "MONTH"}, {{"AllData", each Table.FillDown(Table.Sort(_,{"MONTH_V2", Order.Descending}),{"MONTH_V2"}), type table}}),
    #"Expanded AllData" = Table.ExpandTableColumn(#"Grouped Rows", "AllData", {"MONTH_V2", "VALUE"}, {"MONTH_V2", "VALUE"})
in
    #"Expanded AllData"

 

If you need to end up with the original sort order (which would slow down the query), you need some additional steps:

 

let
    Source = Table1,
    #"Added Index" = Table.AddIndexColumn(Source, "Original Sort", 0, 1),
    #"Grouped Rows" = Table.Group(#"Added Index", {"NAME", "MONTH"}, {{"AllData", each Table.FillDown(Table.Sort(_,{"MONTH_V2", Order.Descending}),{"MONTH_V2"}), type table}}),
    #"Expanded AllData" = Table.ExpandTableColumn(#"Grouped Rows", "AllData", {"MONTH_V2", "VALUE", "Original Sort"}, {"MONTH_V2", "VALUE", "Original Sort"}),
    #"Sorted Rows" = Table.Sort(#"Expanded AllData",{{"Original Sort", Order.Ascending}}),
    #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Original Sort"})
in
    #"Removed Columns"

 

Specializing in Power Query Formula Language (M)

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!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI 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.