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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Dynamic file selection

For a single table display I would like to use one of two input SQL files - one for 2016 and one for 2017. The selection critera will determine which table to use. So if I select 2016, the table will point to the 2016 data file and similiarly will do the same for 2017. The data is mutually exclusive.

 

How can I dynamically select the data file based upon the selection criteria?

 

Thanks

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please try this solution out.

1. Create a table with all the options.

2. Create a measure like this.

Measure =
SWITCH (
    SUM ( 'switch'[Column1] ),
    2006, SUM ( '2006'[Value] ),
    2007, SUM ( '2007'[Value] ),
    BLANK ()
)

Dynamic_file_selection

 

Best Regards,

Dale

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

View solution in original post

4 REPLIES 4
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please try this solution out.

1. Create a table with all the options.

2. Create a measure like this.

Measure =
SWITCH (
    SUM ( 'switch'[Column1] ),
    2006, SUM ( '2006'[Value] ),
    2007, SUM ( '2007'[Value] ),
    BLANK ()
)

Dynamic_file_selection

 

Best Regards,

Dale

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

Thank you for your assistance. This appears to solve my issue.

TonySwad
Frequent Visitor

Because I am unsure as to what you mean by "the data is mutually exclusive,"  I'll suggest first that you might 

1) import the data for 2016 to a table, adding a calculated column for the year if necessary.

2) import the data for 2017 to a table, adding a calculated column for the year if necessary.

3) append the 2016 data table with the 2017 data table.

4) delete the table with just the 2017 data.

 

If the user is selecting the year, that selection can filter the appended data file to use only the relevant data.

Anonymous
Not applicable

Hi - Thanks for the reply. I did combine all of the data into one table but with everything else that is taking place, that solution would not work. I do need to keep them separate (mutually exclusive) and then use the appropriate table based upon the selection criteria. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.