Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all,
I have a table populated with names in different columns. Each row represents salesperson names who worked together on a specific date.
My expected result is a list of names who worked together with the value selected in the slicer but excluding this same value selected in the slicer.
In the example below, we see that 'Sarah' can be in Salesperson 1, Salesperson 2 or Salesperson 3. Also, Sarah has never worked with Caroline, that's why Caroline is not showing in the expected result.
Salesperson 1 | Salesperson 2 | Salesperson 3 |
Sarah | Mike | |
Carlos | Jennifer | |
Nicole | Sarah | |
John | Jennifer | Caroline |
Caroline | Mike | |
Nicole | Carlos | Sarah |
Sarah | Marina | Mike |
EXPECTED result when filtering 'Sarah' on slicer:
Salesperson |
Mike |
Nicole |
Carlos |
Marina |
I've tried so many things but couldn't get a satisfactory result.
Any help is much appreciated.
@GFRO just to let you know 2000 rows are very small, even 2 million, so if you want a scalable solution, unpivot is the way to go. Rest choice is yours.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Create a new calculated table in Power BI that combines all the salesperson names into a single column. You can use the UNION function to achieve this:
AllSalespersons = UNION(VALUES(Sales[Salesperson 1]), VALUES(Sales[Salesperson 2]), VALUES(Sales[Salesperson 3]))
Create a DAX measure to calculate the selected salesperson based on the slicer selection. Let's call this measure "SelectedSalesperson":
SelectedSalesperson = SELECTEDVALUE(AllSalespersons, "")
Create another calculated table to filter out the selected salesperson from the "AllSalespersons" table:
OtherSalespersons = FILTER(AllSalespersons, [AllSalespersons] <> [SelectedSalesperson])
Finally, use a table visual and display the "OtherSalespersons" calculated table. This table will show the list of names who worked with the selected salesperson but exclude the selected salesperson itself.
When you use the slicer to select a salesperson, the table visual will dynamically update to display the names of other salespersons who worked with the selected person, excluding the selected person.
Remember to set up the slicer to use the "SelectedSalesperson" measure for its value selection. This way, the slicer controls the filtering based on the selected salesperson.
Hi Jorge,
I appreciate your help.
However, I couldn't create the metric SelectedSalesperson once Allsalesperson we created in the first place it's a measure. SELECTEDVALUE has a <column> in its syntax. The same applies to the OtherSalesperson measure where FILTER syntax needs a <table>.
Do you see any alternative to overcome that?
FYI - AllSalespersons, The first dax is for creating the table that your are going to need, is not a dax for a measure, is the dax you use when you create a new table.
then you paste the dax
@GFRO the best approach is to unpivot your data, salesperson 1, 2, 3 on rows and you can always visualize using matrix visual to show salesperson 1, 2, 3 on columns, but it will not require any complex calculation to find Sarah. Then you can easily search for the salesperson and it will show wherever it exists.
It is important to shape the data in a way that removes the complexity. I hope it helps.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I appreciate your effort, @parry2k. However, the original table has over 2,000 rows.
It'd be insane to visualize that in the report view.
Do you have any other idea?
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.