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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Create New Table Displaying Unique Values From EACH Column - ignoring row relationships

I am trying to create a slicer that works across all datasets - these datasets are ever changing so I need a seperate table which generates unique values on refresh within Power Query - whilst ignoring row relationships

 

EXAMPLE

 

Input

Unique Product IDManufacturing Plant Material TypeMaterial GroupCountry
45600A08WSAAUK
45601B04WSAARO
45602A02WSAAPO
45603B04WABBUK
45604A06WSAAUK

 

Transformation

 

Manufacturing Plant Material TypeMaterial GroupCountry
A02WAAAPO
A06WSBBRO
A08  UK
B04   
    

 

Any help would be appreciated, I've tried many options but can't seem to remove the row relationship

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

It sounds like you need to create dimension tables for each of the dimensions that you want to slice on.

You can create these dynamically in Power Query by using the following code in a new blank query:

let
    Source = Table.Distinct(Table.SelectColumns(inputTable, "Manufacturing Plant"))
in
    Source

 

Do this for each of the columns that you want to be able to slice against, apply all the tables to your data model, then relate dimensionTable[columnName] to factTable[sameColumnName] on a 1:MANY basis.

Use the dimension table column in any filters/slicers and it will correctly filter your fact table.

 

The principle you are looking for is STAR SCHEMA, and more info can be read here:

https://docs.microsoft.com/en-us/power-bi/guidance/star-schema 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

4 REPLIES 4
Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Anonymous 
It sounds like ou are trying to create several Bridging tables for your Data Model from multiple Fact Tables that share deminsions.  To create a Distinct list for each dimension, you need to use the "Drill Down" tool in Power Query.  If you Right-Click on a Column and choose either "Drill Down" to "Add as New Query".  From the result, you can then use the "Remove Duplicates" tool.

From here the best thing to do is to understand the M Language generated.
Source = #"Original Table"[Original Column],
#"Remove Duplicates" = List.Distinct(Source)

The reason for this is you want add the other table column lists using the "List.Combine" function.  Sorry no button for this.

Source = List.Combine( { #"Original Table"[Original Column] , #"Other Table"[Original Column] , "etc" , "etc" } ),
#"Remove Duplicates" = List.Distinct(Source)

This approach might lead to performance issue if the query folding becomes an issue.  At this point, you may to pull the column lists into individual queries and then merge.  There is concept call List.Buffer that may need to be added.

 

 

Anonymous
Not applicable

H Daryl, I am sure this works but I am too stupid to make it happen 😞 

 

Thank you taking the time to reply - and perhaps someone smarter will benefit from it more

BA_Pete
Super User
Super User

Hi @Anonymous ,

 

It sounds like you need to create dimension tables for each of the dimensions that you want to slice on.

You can create these dynamically in Power Query by using the following code in a new blank query:

let
    Source = Table.Distinct(Table.SelectColumns(inputTable, "Manufacturing Plant"))
in
    Source

 

Do this for each of the columns that you want to be able to slice against, apply all the tables to your data model, then relate dimensionTable[columnName] to factTable[sameColumnName] on a 1:MANY basis.

Use the dimension table column in any filters/slicers and it will correctly filter your fact table.

 

The principle you are looking for is STAR SCHEMA, and more info can be read here:

https://docs.microsoft.com/en-us/power-bi/guidance/star-schema 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Thank you so much for taking the time to reply, this has worked perfectly *chefs kiss* 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors