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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Help with DirectQuery using filtered value

Hello,

 

I have a table with a subset of ID's, when I selects a row from this table I want a query to execute using this value.

For this, I've created a new measure, Target_ID that does a SELECTVALUE, of the active row in the main table.

What I'm not understanding is how to inject this new measure, target_ID, in the query that I have.

MicrosoftTeams-imaged167d238e485b847300923e2e371a5f1a6d183d716e195e44a514fa7857c413e.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Query :

 

let
    T_ID = "10",
    Source = Sql.Database("LocalHost", "AdventureWorks", [Query="select a.* from(#(lf)select '1' as ID#(lf)union all#(lf)select '2' as ID#(lf)union all#(lf)select '3' as ID#(lf)union all#(lf)select '4' as ID#(lf)union all#(lf)select '5' as ID#(lf)union all#(lf)select '6' as ID#(lf)union all#(lf)select '7' as ID#(lf)union all#(lf)select '8' as ID#(lf)union all#(lf)select '9' as ID#(lf)union all#(lf)select '10' as ID#(lf)) a#(lf)where a.ID ='"&T_ID&"'", CommandTimeout=#duration(0, 0, 5, 0)])
in
    Source

 

Thank you for your time and help! 🙂

 

 

 

 

 

1 REPLY 1
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

Waht is your desired result? Could you mean if you select ID 2, it will retrun ID 10 with direct query mode? Is there any logic about it? 

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.