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
carlpaul153
Helper I
Helper I

Load certain rows of a column into the Buffer according to conditions

I have to replicate a series of steps to many files. These files are loaded into power query as a table named "main". Column 1 is an index, and columns 2 and 3 have variable names depending on the files.

On the other hand I have a table called CLDR that has three columns: Character, Category and Languages. One of the Category column values ​​is "Main Letters".

In a blank query I want to buffer the following:

  • Second.Letters = Rows of the column "Character", in which the name of the second column of "main" is included in the column "Languages", and the Category section is equal to "Main Letters".
  • Second.Simbols = Rows of the column "Character", in which the name of the second column of "main" is included in the column "Languages", and the Category section is different from "Main Letters".
  • Third.Letters = Rows of the column "Character", in which the name of the third column of "main" is included in the column "Languages", and the Category section is equal to "Main Letters"
  • Third.Simbols = Rows of the column "Character", in which the name of the third column of "main" is included in the column "Languages", and the Category section is equal to "Main Letters"

I attach the files here https://drive.google.com/drive/folders/1uxFMcvqB6lTS7OCb_YF7_iD6A-jqa1Nx?usp=sharing

Sorry if I'm asking for something too complicated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

thanks to @edhans for including me in the list of possible "solvers".

I understood that the goal is achievable with expressions like this  (this is for SecondLetters, but the others are very similar):

 

 

 

let
    Source = CLDR,
    colsMain=Table.ColumnNames(main),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Languages], colsMain{1})and [Category] = "Main Letters")
    
in
    #"Filtered Rows"

 

 

image.png

 

In any case you can download the file PBIX where I put all together

 

per scaricarli, fai click sul seguente link e segui le istruzioni.

https://giga.allegati.tim.it/r?d=alice.it&wr=rocco.lupoi@telecomitalia.it&ws=sprmnt21&e=alice.it&c=F...

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

thanks to @edhans for including me in the list of possible "solvers".

I understood that the goal is achievable with expressions like this  (this is for SecondLetters, but the others are very similar):

 

 

 

let
    Source = CLDR,
    colsMain=Table.ColumnNames(main),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Languages], colsMain{1})and [Category] = "Main Letters")
    
in
    #"Filtered Rows"

 

 

image.png

 

In any case you can download the file PBIX where I put all together

 

per scaricarli, fai click sul seguente link e segui le istruzioni.

https://giga.allegati.tim.it/r?d=alice.it&wr=rocco.lupoi@telecomitalia.it&ws=sprmnt21&e=alice.it&c=F...

THANK YOU! that was exactly what I was looking for. I could not open your file because I have not bought power BI, I work with power query from excel 365, but your example was still enough. Simple and functional. All I had to do is add those tables to the buffer. My final code looked like this.

 

let
    Source = CLDR,
    colsMain=Table.ColumnNames(main),
    Second.Letters = List.Buffer(Table.SelectRows(Source, each Text.Contains([Languages], colsMain{1})and [Category] = "Main Letters")[Character]),
    Third.Letters = List.Buffer(Table.SelectRows(Source, each Text.Contains([Languages], colsMain{2})and [Category] = "Main Letters")[Character]),
    Second.Simbols = List.Buffer(Table.SelectRows(Source, each Text.Contains([Languages], colsMain{1})and [Category] <> "Main Letters")[Character]),
    Third.Simbols = List.Buffer(Table.SelectRows(Source, each Text.Contains([Languages], colsMain{2})and [Category] <> "Main Letters")[Character])
in
    Third.Simbols

 

Again thank you very much

 

edhans
Super User
Super User

@carlpaul153 I have your files but I have to admit I am having trouble understanding what you want. For example:

"Second.Letters = Rows of the column "Character", in which the name of the second column of "main" is included in the column "Languages", and the Category section is equal to "Main Letters"."

 

  1. Why not normalize the MAIN table and then you can do merges quite easily. It would look like this:
    1.  
       

      2020-09-02 15_41_06-Untitled - Power Query Editor.png

       
  2. "in a blank query I want to buffer..." What does that mean? Do you just mean you want to create a new query that is some sort of combination?
  3. It would be very helpful if you could mock up the expected results in Excel and post a pic of that. I appreciate the actual data files. Just need help with expected results.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Anotación 2020-09-02 203409.png

Second.Letters should look like this image. Third Letters would be similar but would include characters like ñ, á, é, í, ó, ú ...
Second.Simbols and Third.Simbols would be the symbols (characters other than main letters) of the languages "en" and "es" respectively. Please, any questions ask me. I hope I have explained myself well.

Hi @carlpaul153 - I'm still not grasping your goal. Someone else may want to jump in, but your best course of action may be to contact Miguel at his blog and use his consulting services to get this going. It is going to take quite a bit of time (at least an hour or so, perhaps more) to parse this out and get it working, and it seems to me beyond the general scope of "how to do this" for a peer support forum.

I'll tag a few others that I know are good in Power Query and perhaps they will want to jump in, but beyond that, it might be best to ask the person that wrote that article.

@mahoneypat @Anonymous @ImkeF 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thanks @edhans.

  1. I think I understand what you mean by normalizing the table. With the table you have attached I think my goals could be translated in this way:
    -Second.Letters and Third.Letters = For each value of the "attribute" column (en = 2nd column, es = 3th column), buffer the "Character" column, but only those rows in which the category section is equal to "Main letters".
    -Second.Simbols and Third.Simbols = For each value of the "attribute" column, buffer the "Character" column, but only those rows in which the category section is different from "Main letters".
  2. The guide I'm actually basing myself on is this. What I want to do is a modification of step 2, where instead of putting 2 whole columns in Buffer (Old and New in the link), I want to put 4 columns, not complete, but limited with the conditions that I already mentioned.
  3. I will immediately put some example outputs. I'm on it.
 
Greg_Deckler
Super User
Super User

@ImkeF @edhans 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for showing interest @Greg_Deckler , I'll be waiting 🙂

 

@carlpaul153 - Just to be clear, that was me passing the buck! 🙂


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors
Top Kudoed Authors