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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
49 | |
25 | |
20 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
19 | |
18 |