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
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
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.