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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ColinCowan
Helper I
Helper I

Column Fill

Hi, hope somebody can assit I need a seperate column to show Top-2 from "Time-Copy.1 and the Cell above Top-2 to equal Top-2 with all other cells to be zero.

 

Regards Colin

 

ColinCowan_0-1666507641980.png

 

9 REPLIES 9
wdx223_Daniel
Community Champion
Community Champion

NewStep=Table.FormColumns(Table.ToColumns(PreviousStepName)&{List.ReplaceValue(List.Zip({List.Skip(PreviousStepName[#"Time-Copy.1"]),PreviousStepName[#"Time-Copy.1"]}),"Top-2",0,(x,y,z)=>if List.Contains(x,y) then y else z)},Table.ColumnNames(PreviousStepName)&{"NewColumn"})

Daniel

 

Thanks although my skills with powery query are limited do I create a custom column and place the formula

Are you refering to this area of the formula

ColinCowan_1-1666744227368.png

 

click "fx" before the edit bar and copy these code after "="

Table.FormColumns(Table.ToColumns(#"REMOVED SOURCE NAME")&{List.ReplaceValue(List.Zip({List.Skip(#"REMOVED SOURCE NAME"[Time]),#"REMOVED SOURCE NAME"[Time]}),"Top-2",0,(x,y,z)=>if List.Contains(x,y) then y else z)},Table.ColumnNames(#"REMOVED SOURCE NAME")&{"NewColumn"})

Hi

I tried this okay?

ColinCowan_0-1666767546652.png

 

Anonymous
Not applicable

Hi @ColinCowan ,

 

The double quotes in "=" are for emphasis and do not require double quotes over the equal sign.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi thanks yes I tried that previously still did not work

ImkeF
Community Champion
Community Champion

Hi @ColinCowan ,
I don't understand the requirements.
Could you please paste sample data in the correct format (How to provide sample data in the Power BI Forum - Microsoft Power BI Community), and also of the desired output please?
Please check out this article as well: How to Get Your Question Answered Quickly - Microsoft Power BI Community

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

ColinCowan_0-1666738610678.png

 

 

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors