Adding custom columns using List.Distinct

danhendo888

Board Regular
Joined
Jul 15, 2019
Messages
167
Office Version
  1. 365
Platform
  1. Windows
https://1drv.ms/x/s!AvjBsEPEq12ngSB0nBRb6FOkOLJz?e=Jfo3wo

Hey guys,

I am trying to reduce my first table (where I have my data) into the desired output which shows information for unique values in Column C.

In Power Query, I have Grouped By the first four columns.
In the Group By popup menu, I have added one column which does COUNT

After that, I am using this formula on ADD CUSTOM COLUMN option to show unique list for each other column (from Column E to Column K)

i.e.
List.Distinct(Table.Column([Count], "Creation Date"))
List.Distinct(Table.Column([Count], "PO VAT Amount"))
List.Distinct(Table.Column([Count], "Total PO Amount"))
and so on.

But I am doing this one at a time for each column.
Is there a quicker way to do this or does it have to be done individually?

And for the invoice highlighted in orange. How do I make it so that I don't get this result:
https://imgur.com/a/4kTzM29
That is, if there are values in Columns I to Columns K for an invoice, I do not need the other rows for that particular invoice.
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
https://1drv.ms/x/s!AvjBsEPEq12ngSB0nBRb6FOkOLJz?e=Jfo3wo

And for the invoice highlighted in orange. How do I make it so that I don't get this result:
https://imgur.com/a/4kTzM29
That is, if there are values in Columns I to Columns K for an invoice, I do not need the other rows for that particular invoice.

For this question, I suppose I could create a copy of the table in a new query and then merge them with Left.Outer for values in Columns I to K?
If my second table had two columns where the first column was the Order Ref. Then the merge would produce values in the second column.
How would I do it when I need to lookup values for more columns? Is there a short way or do have to do this one by one?
I.e. create three different table with two columns where the second columns are made of values in Columns I to K, respectively
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top