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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.


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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.