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
aroldan
Frequent Visitor

DifferentSource - HELP!

Hi everyone,

Im trying to connect a data source with a parameter but no how Power BI offers.

The thing is that I have two kind of client, the one who use Hana connection and the other that use SQL.

What Im trying to do is something like this:

 

-Create Source Parameters for each one

 

    SQLSource = Sql.Database("server","bd")

    HANASource = SapHana.Database("serverhana")

 

-One parameter to point one of them

    ConnectionSource = SQLSource

    or

    ConnectionSource = HANASource

 

-Finally get this

 

    Source = ConnectionSource

 

Why I'm trying to do this? because I want to avoid to have two reports/forms one for each kind of client.

There's any way to make it?

 

Thanks for your time Smiley Very Happy

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @aroldan,

 

Perhaps you can try to use below conditional query if it suitable for your requirement.


Comment: When ServerName and databaseName are null, use sql connector; if databaseName is null, use hana connector, otherwise return null.

 

let
    SQLOrHana= (ServerName as text, databaseName) =>
    let
        Source= if ServerName <> null and databaseName <> null 
                then Sql.Database(ServerName,databaseName) else 
                if databaseName = null and ServerName <> null then SapHana.Database("serverhana") 
                else null
    in
        Source
in
    SQLOrHana

 

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @aroldan,

 

Perhaps you can try to use below conditional query if it suitable for your requirement.


Comment: When ServerName and databaseName are null, use sql connector; if databaseName is null, use hana connector, otherwise return null.

 

let
    SQLOrHana= (ServerName as text, databaseName) =>
    let
        Source= if ServerName <> null and databaseName <> null 
                then Sql.Database(ServerName,databaseName) else 
                if databaseName = null and ServerName <> null then SapHana.Database("serverhana") 
                else null
    in
        Source
in
    SQLOrHana

 

Regards,

Xiaoxin Sheng

Thank you so much, that was so helpfullSmiley Very Happy

 

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.