Forum Discussion
Getting distinct values for multiple columns
- 10 years ago
- 10 years ago
Hi Abhaykumar,
Use DAX and in DAX the function SUMMARIZE().
Summarize will pull out distinct values from columns.
So your resultset will be new table from Summarize
Table_Output = Summarize(Table_IN,Col1,Col2,Col3)
I hope it helps !
BR,
Achin
Hi Anonymous
sorry, but I cannot follow.
Could you possibly post some sample data?
= List.Distinct(List.Union({#"Obligations by FY"[Project Number],#"CJI3 Actual Cost Data"[Project Number]}))
So, that's the query I created. In my model, I then try to create a relationship between this new column, and the two different "Project Number" columns, so that the new "Project Number" column can be used for filtering purposes in visuals.
I can create one relationship, but upon creating the second relationship, I get the error about ambiguous paths. So, I can't do what I wanted with the new query/column.
- Anonymous6 years agoNot applicable
I guess I'll post a new question. Was just trying to figure out a quick way to make the "one" side of my relationships for two tables that is dynamic, vs. manually joining them into a table to bring in on my own and having to manually refresh that table with new unique values all the time. Creating the table within Power BI by joining the unique values from the two tables seemed like the easiest way to do it, which landed me here.
- nmakani4 years agoRegular Visitor
Hi Brian,
I have a similar use case - were you able to figure this out?
- Anonymous4 years agoNot applicable
Sorry, I can't remember what I ended up doing, and don't have access to that file anymore. More than likely, I solved it via a PowerBI table function, rather than M code.
I remember some situations where I would create a new table that was a union of two other tables, and then create another table that just references that union table (just one column), and somehow making my relationships off of this "3rd leg" table worked without the ambguity errors that happen when using that "in-between" table. Can't remember if that was my fix for this situation, but you might give that a try. It's some kind of loophole (at least it is in my mind; I'm sure someone smarter has a techncial explanation for why that works).