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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
dwel0120
Helper III
Helper III

Include Value if any of the selected columns are not blank

I am trying to include values in a new table from an existing table IF any one of the columns is not blank. 

 

Here is my current query: 

 

Selector =
SELECTCOLUMNS('GEO_ADULT',
"State",'GEO_ADULT'[STATENAME],
"City",'GEO_ADULT'[CITY],
"Latitude",'GEO_ADULT'[LAT],
"Longitude",'GEO_ADULT'[LON]
)
 
dwel0120_0-1643919738660.png

 

1 ACCEPTED SOLUTION

Hi @dwel0120 ,

 

It is easier to implement in Power Query Editor.

 

let
    Source = Table.FromValue(GEO_ADULT),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each [Value] <> null and [Value] <> ""),
    #"Selected Columns" = Table.SelectColumns(Source,List.Distinct(#"Filtered Rows"[Attribute]))
in
    #"Selected Columns"

vkkfmsft_0-1644476447889.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @dwel0120 

It is possible only if you have a fixed number of columns. If this is ok with you then I'll post my solution by tomorrow. Thanks!

ValtteriN
Super User
Super User

Hi,

Try this kind of logic:

SELECTCOLUMNS(FILTER(ItemExample,not(ISBLANK(ItemExample[Column]))||not(ISBLANK(ItemExample[Item]))),
"Item",ItemExample[Item],"column",ItemExample[Column])
 
ValtteriN_0-1643921160414.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




That didn't work...

 

Selector =
SELECTCOLUMNS(FILTER('GEO_ADULT', not(ISBLANK(GEO_ADULT[STATENAME]))||not(ISBLANK(GEO_ADULT[CITY]))||not(ISBLANK(GEO_ADULT[LAT]))||not(ISBLANK(Geo_Adult[lon]))),
"State",'GEO_ADULT'[STATENAME],
"City",'GEO_ADULT'[CITY],
"Latitude",'GEO_ADULT'[LAT],
"Longitude",'GEO_ADULT'[LON]
)

dwel0120_0-1643922223619.png

 

Hi @dwel0120 ,

 

It is easier to implement in Power Query Editor.

 

let
    Source = Table.FromValue(GEO_ADULT),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each [Value] <> null and [Value] <> ""),
    #"Selected Columns" = Table.SelectColumns(Source,List.Distinct(#"Filtered Rows"[Attribute]))
in
    #"Selected Columns"

vkkfmsft_0-1644476447889.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Are you creating this as a blank query?

Hi @dwel0120 ,

 

Yes, I created a blank query.

 

Best Regards,
Winniz

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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