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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
FilipFireFlyBI
Resolver I
Resolver I

Dynamically reference other query

Hi,

 

I have 5 queries from Excel source, and 5 similar queries from Dataflow Source.
Now I want to easily choose whether I want to use the Excel / Dataflow source.

Both query names only differ in their name (it starts with Excel or DF).

Therefore I created a Parameter with just 2 values: Excel or DF

Now I create a new query that uses that parameter (see the fact Population example below).

The result is just a text DF fact population.

What I want is to see this table itself, and when I change the parameter to Excel that I then see the Excel table itself here.

 

In the query fact Population I now use this M:

 

let
Source = Sourcetype&" fact Population"
in
Source

 

 

FilipFireFlyBI_0-1656053523968.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@FilipFireFlyBI , Add both of these using the required code as table 

 

Source = <Code to take data from excel>

Source2 = < Code to take data from DF>

Source3 = if parameter ="excel" then Source else Source2

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
FilipFireFlyBI
Resolver I
Resolver I

Thanks for the easy solution!
Here the M code:


let
SourceExcel = #"Excel fact Population",
SourceDF = #"DF fact Population",
Source= if SourcetypeParameter = "DF" then SourceDF else SourceExcel

in
Source

amitchandak
Super User
Super User

@FilipFireFlyBI , Add both of these using the required code as table 

 

Source = <Code to take data from excel>

Source2 = < Code to take data from DF>

Source3 = if parameter ="excel" then Source else Source2

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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