Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am struggling with a pretty basic formula. This is the code I'm testing on daxstudio:
ADDCOLUMNS (
ExternalVendorDocNumber,
"new",
CONCATENATEX (
RELATEDTABLE ( GLandPostedPurchaseInvoiceLines ),
DISTINCT(GLandPostedPurchaseInvoiceLines[Document No.]),
", "
)
)
Addcolumns is just to give a row context. What I don't get is why Distinct isn't working here? This works fine if I don't use Distinct but ofcourse I just need the distinct from the column.
I've also tried using all and values but ofcourse all these functions give the same error " A table of multiple values was supplied where a single value was expected."
Solved! Go to Solution.
I haven't looked in detail but try these. If it doesn't work , share the pbix with the expected result
ADDCOLUMNS (
ExternalVendorDocNumber,
"new",
CONCATENATEX (
DISTINCT ( RELATEDTABLE ( GLandPostedPurchaseInvoiceLines ) ),
GLandPostedPurchaseInvoiceLines[Document No.],
", "
)
)
ADDCOLUMNS (
ExternalVendorDocNumber,
"new",
CONCATENATEX (
CALCULATETABLE (
DISTINCT ( GLandPostedPurchaseInvoiceLines[Document No.] ),
RELATEDTABLE ( GLandPostedPurchaseInvoiceLines )
),
GLandPostedPurchaseInvoiceLines[Document No.],
", "
)
)
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
I haven't looked in detail but try these. If it doesn't work , share the pbix with the expected result
ADDCOLUMNS (
ExternalVendorDocNumber,
"new",
CONCATENATEX (
DISTINCT ( RELATEDTABLE ( GLandPostedPurchaseInvoiceLines ) ),
GLandPostedPurchaseInvoiceLines[Document No.],
", "
)
)
ADDCOLUMNS (
ExternalVendorDocNumber,
"new",
CONCATENATEX (
CALCULATETABLE (
DISTINCT ( GLandPostedPurchaseInvoiceLines[Document No.] ),
RELATEDTABLE ( GLandPostedPurchaseInvoiceLines )
),
GLandPostedPurchaseInvoiceLines[Document No.],
", "
)
)
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Awesome! It works! It works!!!
Thanks a million!
Hi @Mueez
Why would you need the DISTINCT()? CONCATENATEX is an iterator and expects a scalar as second argument, so using DISTINCT() will not work.
https://dax.guide/concatenatex/
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Thanks @AlB for replying.
I need CONCATENATEX to get me just unique values as an answer. Final answer is basically supposed to look like a unique concatenation of all values of a column of the RELATEDTABLE.
Sure, I didn't say you don't need CONCATENATEX, I said you don't need the DISTINCT
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
The aim is to eliminate yellow highlighted duplicates.
@AlB
There are duplicates in the result that second part (expression) of CONCATENATEX is giving. I don't know how to remove those duplicate values
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |