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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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

 

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

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors