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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Fetch Data based from a table where we can define that get data if field value = contract name

Dears,

 

I am fetching the data from SQL database using the below query

 

let
Source = Sql.Databases("database name"),
evo = Source{[Name="evo"]}[Data],
dbo_F_CONTRACT = evo{[Schema="dbo",Item="F_CONTRACT"]}[Data]
in
dbo_F_CONTRACT

 

The above query is giving me the data for all contracts, that bring in 100000 lines items, but I need to bring the data only related to the contract I am making the report for using field where CTR_PREFIX = Contract Prefix (every prefix I add here, the query should only bring the data for that specific prefix.)

 

F_Contract is a table, and CTR_PREFIX is the Field I need to filter

 

Can someone help me how to add this to the query as I am new to power bi and dax.

 

I would highly appreciate your help and support

 

Regards,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Icey, sorry for not replying earliear, it did not solve my problem, i did it through filtering

View solution in original post

3 REPLIES 3
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem solved?


If it is solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.


If not, please let me know.

 


Best Regards,
Icey

Anonymous
Not applicable

Hi Icey, sorry for not replying earliear, it did not solve my problem, i did it through filtering

sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

You can alter your connection in the advanced editor:

Sql.Database("database name", "DataWarehouse", [Query="SELECT * FROM [DataWarehouse].[dbo].[F_CONTRACT] where CTR_PREFIX = 'yourPrefix'"]),
    dbo = Source{[Schema="dbo",Item="Snapshots"]}[Data]

Or, perhaps easier, double click on the source step in power query, click on 'advanced options' and type/copy-paste you sql query:

SELECT * FROM [DataWarehouse].[dbo].[F_CONTRACT] where CTR_PREFIX = 'yourPrefix'

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors