cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Community Support
Community Support

Re: DifferentSource - HELP!

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

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

View solution in original post

2 REPLIES 2
Community Support
Community Support

Re: DifferentSource - HELP!

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

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

View solution in original post

aroldan
Frequent Visitor

Re: DifferentSource - HELP!

Thank you so much, that was so helpfullSmiley Very Happy

 

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors