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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 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.