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
Anonymous
Not applicable

Remove NaN with Direct Query

paul_2121_0-1710326076950.png

Is there a way to remove the rows where only NaN is stated in Direct Query?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

The method provided by @PijushRoy is quite good. If it does not work, please try mine.

 

When connecting to the data source, expand the Advanced, you will see the following options as shown above.

vhuijieymsft_0-1710399948396.png

 

Command timeout in minutes: This option provides the time it takes the query to execute in SQL Server. If your connection lasts longer than 10 minutes (the default timeout), it will terminate; else, you can enter another value in minutes to keep the connection open longer. This option is only available in Power Query Desktop.

 

SQL statement (optional, requires database😞 This is where you write or paste the query that will filter the database and return the necessary information. When its completes execution, it will automatically load to Power Query for transformation.

 

Include relationship columns: If checked, includes columns that might have relationships to other tables. If this box is cleared, you won’t see those columns. This is important if your query has SQL JOINS.

 

Navigate using full hierarchy: If checked, the Navigator displays the complete hierarchy of tables in the database you’re connecting to. If cleared, Navigator displays only the tables whose columns and rows contain data.

 

Enable SQL Server Failover support: If checked, when a node in the SQL Server failover group isn’t available, Power Query moves from that node to another when failover occurs. If cleared, no failover will occur.

 

Please try:

 

Enter a SQL statement in SQL Statement and import only the data whose 'Energy yield [GWH]' column is not null.

 

The specific SQL statements may vary depending on the data source.

 

For example, the SQL statement of the SQL Server data source is:

SELECT *
FROM Test1
WHERE Energy yield [GWH]IS NOT NULL
   AND Energy yield [GWH]<> '';

 

Among them, Test1 is the table name and Energy yield [GWH] is the column name.

 

Once you are done, click Ok. It will automatically load to Power Query for transformation.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous ,

 

The method provided by @PijushRoy is quite good. If it does not work, please try mine.

 

When connecting to the data source, expand the Advanced, you will see the following options as shown above.

vhuijieymsft_0-1710399948396.png

 

Command timeout in minutes: This option provides the time it takes the query to execute in SQL Server. If your connection lasts longer than 10 minutes (the default timeout), it will terminate; else, you can enter another value in minutes to keep the connection open longer. This option is only available in Power Query Desktop.

 

SQL statement (optional, requires database😞 This is where you write or paste the query that will filter the database and return the necessary information. When its completes execution, it will automatically load to Power Query for transformation.

 

Include relationship columns: If checked, includes columns that might have relationships to other tables. If this box is cleared, you won’t see those columns. This is important if your query has SQL JOINS.

 

Navigate using full hierarchy: If checked, the Navigator displays the complete hierarchy of tables in the database you’re connecting to. If cleared, Navigator displays only the tables whose columns and rows contain data.

 

Enable SQL Server Failover support: If checked, when a node in the SQL Server failover group isn’t available, Power Query moves from that node to another when failover occurs. If cleared, no failover will occur.

 

Please try:

 

Enter a SQL statement in SQL Statement and import only the data whose 'Energy yield [GWH]' column is not null.

 

The specific SQL statements may vary depending on the data source.

 

For example, the SQL statement of the SQL Server data source is:

SELECT *
FROM Test1
WHERE Energy yield [GWH]IS NOT NULL
   AND Energy yield [GWH]<> '';

 

Among them, Test1 is the table name and Energy yield [GWH] is the column name.

 

Once you are done, click Ok. It will automatically load to Power Query for transformation.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

PijushRoy
Super User
Super User

Hi @Anonymous 

Please go to the Power Query editor filter out NaN and load the data into the Power BI desktop.

Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Anonymous
Not applicable

That step ist not possible for the direct query, i would hace to change it to an import and i need the direct query

Hi @Anonymous 

Did you try to filter with Direct Query and load the data?



Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Anonymous
Not applicable

Yes, i need to change the query type so that does not work

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.