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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

How to Create a New Table from existing table using IN POWER QUERY NOT IN Data model

How to Create a New Table from existing table using EDIT QUERY in POWER BI? IN POWER QUERY NOT IN DATA MODEL
Example : 

Table A
NameIDAmountProduct
surya111324Milk
surya11132423chocolate
dinesh22252432cherry
dinesh222234324orange
Prem333523423apple
Vishnu44442342Juice


Result (Expected Table) : I want to fetch column 'ID and Name' from table A using DISTINCT Fuction.

Table B
NameID
surya111
dinesh222
Prem333
Vishnu444


It would be great if you help me.
Thanks in Advance!

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

 

I also use the option "Group By" to do it. You could have a try.

let
    Source = Table,
    #"Grouped Rows" = Table.Group(Source, {"Name", "ID"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Count"})
in
    #"Removed Columns"

3.gif 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

 

I also use the option "Group By" to do it. You could have a try.

let
    Source = Table,
    #"Grouped Rows" = Table.Group(Source, {"Name", "ID"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Count"})
in
    #"Removed Columns"

3.gif 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mhossain
Solution Sage
Solution Sage

@Anonymous 

 

Multiple solutions here, all of them are great, you can also consider

Right click on your table in powerquery ==> Duplicate ==> on this new table click 'Group BY' in the tool bar.

edhans
Super User
Super User

Hi @Anonymous do the following to get a table like you want:

  1. Right-click on Table A and select "Reference"
  2. In the new query, right-click on the ID column and select Remove Other Columns
  3. Right-click again on ID column and "Removed Duplicates"

edhans_0-1598541262056.png

Now you can use this as a DIM table in your model. I do this all of the time, creating DIM tables from FACT tables. 👍



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
Anonymous
Not applicable

image.png

after loaded your tabIN, create a new blank query under NewSource tools.

Then load the columns you want to operate on :

 

image.png

 

 

and finally remove duplicate (a tool under remove rows group):

 

image.png

 

 

and you get what you want:

 

image.png

 

 

Greg_Deckler
Super User
Super User

@Anonymous - Right-click your first query and select Reference.


Follow on LinkedIn
@ 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors