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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
smpa01
Super User
Super User

Conditional selection Table

Hello Experts,

 

I have Raw data as following

let
    S = {{1},{0},{0},{2}},
    CT = Table.FromList(S, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    AC= Table.AddIndexColumn(CT, "Index", 1, 1)
in
    AC

Is there a way to select this table with where Column1 lists <>{0} after AC in one step

let
    S = {{1},{0},{0},{2}},
    CT = Table.FromList(S, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    AC= Table.AddIndexColumn(CT, "Index", 1, 1),
    #"Expanded Column1" = Table.ExpandListColumn(AC, "Column1"),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Column1", each ([Column1] <> 0))
in
    #"Filtered Rows"

Desired Output

 

I want to reach to output from AC in one step. Is it possible ?

 

Thank you in advance.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
2 ACCEPTED SOLUTIONS
smpa01
Super User
Super User

let
    S = {{1},{0},{0},{2}},
    CT = Table.FromList(S, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    AC= Table.AddIndexColumn(CT, "Index", 1, 1),
    Custom1 = Table.SelectRows(AC, each [Column1]<>{0})
in
    Custom1
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

Anonymous
Not applicable

Maybe something like this?

let
    S = {{1},{0},{0},{2}},
    AC= Table.AddIndexColumn(Table.FromList(S, Splitter.SplitByNothing(), null, null, ExtraValues.Error), "Index", 1, 1),
  
     #"Filtered Rows" = 
        Table.SelectRows(
            Table.ExpandListColumn(AC, "Column1"), each ([Column1] <> 0))
in
    #"Filtered Rows"

Nesting M functions.png

 

Could also write a fucntion with all the steps and when you call it it will only show the function name. Just a thought

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Maybe something like this?

let
    S = {{1},{0},{0},{2}},
    AC= Table.AddIndexColumn(Table.FromList(S, Splitter.SplitByNothing(), null, null, ExtraValues.Error), "Index", 1, 1),
  
     #"Filtered Rows" = 
        Table.SelectRows(
            Table.ExpandListColumn(AC, "Column1"), each ([Column1] <> 0))
in
    #"Filtered Rows"

Nesting M functions.png

 

Could also write a fucntion with all the steps and when you call it it will only show the function name. Just a thought

great @Anonymous  appreciate it. Thank you very much for stopping by. Better to have more aresnal and I prefer that way. Thanks for the contribution.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

My pleasure. This place is great to see the different ways of solving problems. And always in for a good Power Query question 🙂

smpa01
Super User
Super User

let
    S = {{1},{0},{0},{2}},
    CT = Table.FromList(S, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    AC= Table.AddIndexColumn(CT, "Index", 1, 1),
    Custom1 = Table.SelectRows(AC, each [Column1]<>{0})
in
    Custom1
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.