Forum Discussion
How do I get a unique list ?
- 9 months ago
Hi EaglesTony ,
In Power Query you would use the Table.Distinct() function.
Your two new tables (if you want them to be new tables) would be created as follows:
-1- Reference your main table into two new queries
-2- Remove the column that won't be used in each.
-3- Press Ctrl+A to select the whole table (or Ctrl+Click both columns you want to have unique combinations of).
-4- Go to the Home tab > Remove Rows > Remove Duplicates.
This should create a new code line something like this:
= Table.Distinct(Source, {"IDENTITY", "RoleName"})Pete
- 9 months ago
Hi EaglesTony ,
Please follow these steps to get the result:
1. In Home Tab, go to transform data, It will open power query editor for you.(Home β Transform Data β Power Query Editor.)
2. Right Click your main table and duplicate it and rename it 'Distinct Rolnames'
3.Select two columns that are needed holding CTRL and select Identity and Rolename and right click and select remove other columns.
4.Again select both the columns holding CTRL and select Identity and Rolename and right click and select remove duplicates or (Home β Remove Rows β Remove Duplicates.)
Now you can see the desired output.5. Click Close and Apply.
6.Similar steps please follow for the 2nd output.
7. If you see summarization sign in front of identity in Fields section then change it to "Do Not Summarize". It will wont add up the identity column and will give you desired output.π I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
π‘ Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
π As a proud SuperUser and Microsoft Partner, weβre here to empower your data journey and the Power BI Community at large.
π Curious to explore more? [Discover here].
Letβs keep building smarter solutions together!
Hello EaglesTony,
Thank you for reaching out to the Microsoft fabric community forum.
I have reproduced your scenario in Power BI using the sample data you provided and was able to get the exact expected results two unique lists, one for RoleName and one for RolePersonName.
To achieve this, I used calculated tables in DAX instead of Power Query.
Below are the DAX expressions used:
Unique Roles Table:
UniqueRoles =
DISTINCT (
SELECTCOLUMNS (
Roles,
"IDENTITY", Roles[IDENTITY],
"RoleName", Roles[RoleName]
)
)
Unique Persons Table :
UniquePersons =
DISTINCT (
SELECTCOLUMNS (
Roles,
"IDENTITY", Roles[IDENTITY],
"RolePersonName", Roles[RolePersonName]
)
)
Iβve also attached a .pbix file for your reference showing the exact setup and results.
Best regards,
Ganesh Singamshetty.