Forum Discussion
Unique values dynamically linked to multiple value columns
I am trying to transform data from a SharePoint list in Power Query Editor. That List has several single value columns and several multiple choice value columns. What I would like is to have those multiple values relate to one unique value (which will be used as the Count value in the Power BI report). Here's an example of what I have and what I've tried:
| Name | Age | Locations lived | Languages spoken |
| John | 30 | [List] | [List] |
| Ben | 35 | [List] | [List] |
| Jerry | 40 | [List] | [List] |
I've then applied 'Expand to new rows' to Locations lived and Languages spoken in Query Editor and got:
| Name | Age | Locations lived | Languages spoken |
| John | 30 | New York | English |
| John | 30 | Chicago | Italian |
| Ben | 35 | New York | English |
| Ben | 35 | Seattle | French |
| Ben | 35 | Portland | null |
| Jerry | 40 | San Francisco | English |
| Jerry | 40 | Los Angeles | Spanish |
But this duplicates my Name column, so when I create a Report to see a chart of the unique count of Names and the multiple Languages spoken, it will count John's as two, Ben's as two and so on. Instead, I would like the values New York and Chicago, and English and Italian, to relate to one count for John.
If I do this another way and Extract values and concatenate, and then drag the 'Name' column to Values (under Visualizations), it will count John once but also show 'New York,Chicago' as one value and 'English,Italian' as one value.
Any suggestions as to how I can have multiple values in a column relate to just one unique column (in this case 'Name')?
I've tried choosing 'Count (Distinct)' for every chart created in the report, but this works for simple Visualizations, and skews the data for more complex ones. So I'd rather do it right and link column dynamically in Query Editor, rather than manually selecting Distinct Count in the report every time.
Hi user180618
Check this file: Download PBIX
Did I answer your question? Mark my post as a solution!
Ricardo
7 Replies
- user180618Helper I
I've gone with extracting and concatenating the values, so now have:
Name Age Location lived Languages spoken John 30 New York,Chicago English,Italian Ben 35 New York,Seattle,Portland English,French Jerry 40 San Francisco,Los Angeles English,Spanish However, when I create a report and under Legend choose the column 'Location lived' and choose 'Count of Name' under Value, I cannot get it to show me the Location lived and Languages spoken values separately. So for example, I'd like a pie chart visualization for Ben to show me 1 count each for New York, Seattle and Portland, and 1 count each for English and French.
Is there a way to do this without running an R script in Query Editor?
- camargos88Community Champion
Why don't you split the values by comma, so you can achieve it.
Did I answer your question? Mark my post as a solution!
Ricardo- user180618Helper I
I've already split them by commas in Query Editor (see previous post), but it comes out like this in the report:
I'd like it to show me the count value for those cities separately, but for the Name column to be the main aggregator.
- v-juanli-msftCommunity Support
Hi
Is this problem sloved?If it is sloved, could you kindly accept it as a solution to close this case and help the other members find it more quickly?If not, please feel free to let me know.Best RegardsMaggie