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
tmyers1152
Frequent Visitor

Trouble with relationship and/or slicer

I have run into a problem with a sales report I am doing. I have sales to one customer that needs to also be assigned to another customer but still show up for both, so if you have customer 1 and 2, when you filter by 1 you see of their sales but when you filter 2 you see all of their sales plus some of customer 1. My facts table (tblTicketDetails) and diminsion table (tblCustomers) are linked via a 1 to many relantionship on account #. I made a new field in tblCustomers called LookupAccount (thank you to reddit for the idea) where nearly all the numbers match the account # except where I need them to be assigned to multiples, in which case account # is one thing but lookupaccount is another (such as account 123 has a lookupaccount of 345 rather than also being 123).

 

How do I apply this practically? I can't have my slicers using lookupaccount as it would be numbers that made no sense to the user so I have to keep it as the customer name. I can't join the table via lookupaccount as that creates a many-to-many which I personally dont understand how to work with (and when I did, I did not notice a change).

 

Here is a snip of the two tables in question just for reference.

tmyers1152_0-1655398851055.png

 

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

Hi @tmyers1152 ,

 

Suppose you have the following sample data and expect the output to be that when the slicer selects Account 1, the fact table will filter the values of Account 1 and 2.

 

vkkfmsft_0-1655711729047.png   vkkfmsft_1-1655711739223.png

 

If this is the case, please create the following new table in Power Query and then create the relationships between the tables.

 

let
    Source = Table.SelectColumns(tblCustomers,{"Account #","LookupAccount"}),
    AppendAccount = Table.AddColumn( Table.SelectColumns(tblCustomers,"Account #"),"LookupAccount", each [#"Account #"]),
    CombineTable = Table.Combine({Source, AppendAccount})
in
    CombineTable

vkkfmsft_2-1655713081538.png

vkkfmsft_3-1655713303411.png

vkkfmsft_4-1655713315188.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

1 REPLY 1
v-kkf-msft
Community Support
Community Support

Hi @tmyers1152 ,

 

Suppose you have the following sample data and expect the output to be that when the slicer selects Account 1, the fact table will filter the values of Account 1 and 2.

 

vkkfmsft_0-1655711729047.png   vkkfmsft_1-1655711739223.png

 

If this is the case, please create the following new table in Power Query and then create the relationships between the tables.

 

let
    Source = Table.SelectColumns(tblCustomers,{"Account #","LookupAccount"}),
    AppendAccount = Table.AddColumn( Table.SelectColumns(tblCustomers,"Account #"),"LookupAccount", each [#"Account #"]),
    CombineTable = Table.Combine({Source, AppendAccount})
in
    CombineTable

vkkfmsft_2-1655713081538.png

vkkfmsft_3-1655713303411.png

vkkfmsft_4-1655713315188.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.