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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
amaleranda
Post Patron
Post Patron

Filter Rows from database Berofe Import to PowerBI

Hi

Hope someone can guide me. 

 

I have a table stored in azure with 5 rows(example only). from that tabel I need to import only 3 rows. FIlter is based on one or more colums see below 

 

Table in Azure (SQL)

 

Col1Col2Col3col4
1AppleSummerHot
2AppleSummercold
3BananaSummeHot
4MangoWintercold
5FruitWinterhot

 

Output table in PBIX file

 

Col1Col2Col3col4
1AppleSummerHot
2AppleSummercold
3BananaSumme

Hot

 

Criteria here is filter for rows in Col3 to be Summer. 

 

 I want filtering to be happen before import. I understand that I can filter rows arter I import all 5 rows to the PBIX file. Case here is my tables have more than 50million rows. 

 

 

PS:also need to know how to add Col4 for the same filter

1 ACCEPTED SOLUTION

Below code would work in if your data alredy in PowerBI

 

let
Source = Sql.Database("SourceName", "DatabaseName", [Query="SELECT *#(lf)FROM [AHS].[Application]#(lf)WHERE [Application Ref] = '148'"])
in
Source

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @amaleranda

If you want to filter data before the data has been imported into PBI, you could click Get Data->advanced options and write some SQL statements to achieve data you want.

2.png

Example sql statement

SELECT     *
FROM      table 
WHERE   (Col3 in(' Summer' , ’ Summe’) )

Ht @v-juanli-msft

 

Thanks a lot for the reply

 

My data model is already in the PowerBI( so I cannot use Get Data). I am going to additional row into the related sql tablse. 

 

I do not want those additional rows in my current PowerBI data model.

 

For instance my current Azure SQL table(TblA) has 10 row at the moment. Those 10 rows are in my current PowerBI Data model.

I am in the proces of adding another 5 rows to the TblA to make it 15 rows. From those 15 rows I only need 11 rows in my current PowerBI Data model.

 

I know I can filter out data from PowerBI data model using a simple column filter. I just want to stop getting additional columns (exclude 4 frolums) when import job is happening. 

Below code would work in if your data alredy in PowerBI

 

let
Source = Sql.Database("SourceName", "DatabaseName", [Query="SELECT *#(lf)FROM [AHS].[Application]#(lf)WHERE [Application Ref] = '148'"])
in
Source

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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