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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Analitika
Post Prodigy
Post Prodigy

Transform data from file

Now im use thsi formula

 

let
Source1 = Sybase.Database(SelectServer, SelectDatabase1),
DBA_view_DidknObj1 = Source1{[Schema="DBA",Item="view_DidknObj"]}[Data],
Source2 = Sybase.Database(SelectServer, SelectDatabase2),
DBA_view_DidknObj2 = Source2{[Schema="DBA",Item="view_DidknObj"]}[Data],

Append = Table.Combine( {DBA_view_DidknObj1, DBA_view_DidknObj2} ),
#"Sorted Rows" = Table.Sort(Append,{{"OPE_ID", Order.Ascending}})
in
#"Sorted Rows"

 

 

But i have about 100 sources wich dinamically  changes, it is possible this part

 

Source1 = Sybase.Database(SelectServer, SelectDatabase1),
DBA_view_DidknObj1 = Source1{[Schema="DBA",Item="view_DidknObj"]}[Data],

 

take from text file which i will generate with other tool, or PBi can do that for me? for example take list of databases from txt file and loop throught them?

 

 

4 REPLIES 4
amitchandak
Super User
Super User

@Analitika , The information you have provided is not making the problem clear to me. Can you please explain with an example.
If you have same file. You can merge them and apply transformation

https://powerbi.microsoft.com/en-us/blog/combining-excel-files-hosted-on-a-sharepoint-folder/
Appreciate your Kudos.


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

I have text or excel file

 

IP | Dbname

100.11.11.23 | db1

100.10.110.20 | db2

100.101.111.03 | db3

100.1.101.11 | db4

 

i need this file convert to

 

let
Source1 = Sybase.Database("100.11.11.23", "db1"),
     DBA_view_DidknObj1 = Source1{[Schema="DBA",Item="view_DidknObj"]}[Data],
Source2 = Sybase.Database("100.10.110.20", "db2"),
     DBA_view_DidknObj2 = Source2{[Schema="DBA",Item="view_DidknObj"]}[Data],

Source3 = Sybase.Database("100.101.111.03", "db3"),
     DBA_view_DidknObj3 = Source3{[Schema="DBA",Item="view_DidknObj"]}[Data],

Source4 = Sybase.Database("100.1.101.11", "db4"),
     DBA_view_DidknObj4 = Source4{[Schema="DBA",Item="view_DidknObj"]}[Data],

 

Append = Table.Combine( {DBA_view_DidknObj1, DBA_view_DidknObj2, DBA_view_DidknObj3, DBA_view_DidknObj4} ),
#"Sorted Rows" = Table.Sort(Append,{{"OPE_ID", Order.Ascending}})
in
#"Sorted Rows"

 

now i need  do same thing with 100 sources

This is a good use of a custom function.  Here is how to approach this.

 

1.  Make a table with your 100 sets of values (IP and database name).  Set both to Text data type.

2. Make a custom function like this one (make a blank query and paste this M code over the existing code in the Advanced Editor).  Call it something like fxData

(ipnumber, dbase) =>

let

Source = Sybase.Database(ipnumber, dbase),

DBA_view = Source{[Schema="DBA",Item="view_DidknObj"]}[Data]

in

DBA_view

 

3. On your first table, on Add Column tab click on Invoke Custom Function.  Choose fxData (or whatever you called it), and select the correct two columns as input.

 

4. At this point you should have a table of 100 tables.  Simply click the expand button on the top of the tables column to expand and combine all the data.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Pragati11
Super User
Super User

Hi @Analitika ,

 

You requirement is not clear. Add details please.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.