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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

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
Super User
Super User

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 Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Kudoed Authors