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 there,
I am trying to print values for a specific column. for example the column name is ABC and it is occured 18 times for a key, the output needs to be as per below.
Cheers,
// Assumption is that you've got a table T
// where the structure is more or less this:
// Key | Column
// ----------------
// 1 | ABC
// 1 | ABC
// 2 | XYZ
// 2 | XYZ
// 2 | XYZ
// ...
// From your sample it looks like a key
// can only have one distinct value in
// the Column column.
[Output] =
IF(
// make sure that only one Key is
// visible in the current context
// and it's filtered directly.
HASONEFILTER( T[Key] ),
// The below will only work correctly
// if the assumption above is in force.
// Otherwise, SELECTEDVALUE will return
// BLANK() and you'll end up with a string
// of delimiters only or just an empty
// string.
var __numOfVals = COUNTROWS( T )
var __columnVal = SELECTEDVALUE( T[Column] )
var __ouput =
CONCATENATEX(
GENERATESERIES(1, __numOfVals, 1),
__columnVal,
":|"
)
return
__output
)
And, of course, [Output] is a MEASURE, not a calc column.
Best
D
Thanks @Anonymous The below measure works well.
I want to add one more column which is a unique number for each "ABC" value.
Cheers,
Rutika
Hi @Anonymous
I want to add one more column in the concatenate e.g.
What's wrong with using REPT() ?
Include the delimiter in the call to REPT and throw away the last character of the result.
Because it's fun, and an opportunity to test a function I didn't even know until very recently.
@Anonymous , Can you explain the logic of output, not able to connect.
Hi Amit,
Basically I want to concatenate the output the number of times it appears as per the column headers.
Hopefully this explains !
Cheers,
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 |
---|---|
43 | |
23 | |
21 | |
15 | |
15 |
User | Count |
---|---|
45 | |
31 | |
30 | |
18 | |
17 |