Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I have a table with values that I need concatenat by number of Year-WeekOfYear. Agree a example.
Original:
| AñoSemana | Filtros preparación | Índice |
| 2019-S3 | L1 | 1 |
| 2019-S3 | L1 | 2 |
| 2019-S4 | L7 | 3 |
| 2019-S4 | L7 | 4 |
| 2019-S4 | L7 | 5 |
| 2019-S4 | L1 | 6 |
| 2019-S5 | L6 | 7 |
| 2019-S5 | L6 | 8 |
Result:
| AñoSemana | Filtros preparación | Índice | Filtros preparación Semana |
| 2019-S3 | L1 | 1 | |
| 2019-S3 | L2 | 2 | L1, L2 |
| 2019-S4 | L7 | 3 | |
| 2019-S4 | L4 | 4 | |
| 2019-S4 | L6 | 5 | |
| 2019-S4 | L1 | 6 | L7, L4, L6, L1 |
| 2019-S5 | L5 | 7 | |
| 2019-S5 | L6 | 8 | L5, L6 |
Regards,
Xavi
Solved! Go to Solution.
Calculated column in the first table:
Calc Column =
VAR last_ =
CALCULATE ( MAX ( Table1[Índice] ), ALLEXCEPT ( Table1, Table1[AñoSemana] ) )
RETURN
IF (
Table1[Índice] = last_,
CONCATENATEX (
CALCULATETABLE (
DISTINCT ( Table1[Filtros preparación] ),
ALLEXCEPT ( Table1, Table1[AñoSemana] )
),
Table1[Filtros preparación],
", "
)
)
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @XaviOV ,
Create a calculated column as below:
Filtros preparación Semana =
var _maxvalue=MAXX(FILTER('Table','Table'[AñoSemana]=EARLIER('Table'[AñoSemana])),'Table'[Índice])Return
IF('Table'[Índice]=_maxvalue,CONCATENATEX(FILTER('Table','Table'[AñoSemana]=EARLIER('Table'[AñoSemana])),'Table'[Filtros preparación],","),BLANK())
And you will see:
For the related .pbix file,pls click here.
Calculated column in the first table:
Calc Column =
VAR last_ =
CALCULATE ( MAX ( Table1[Índice] ), ALLEXCEPT ( Table1, Table1[AñoSemana] ) )
RETURN
IF (
Table1[Índice] = last_,
CONCATENATEX (
CALCULATETABLE (
DISTINCT ( Table1[Filtros preparación] ),
ALLEXCEPT ( Table1, Table1[AñoSemana] )
),
Table1[Filtros preparación],
", "
)
)
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Can also be done in the query editor
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQNNlbSUfIxBBKGSrE6KIJGQMIISdAEJGgOJIzRBUGECbqgGZAwRRcEWWSGJGgKEgQR5uiCIO0WSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [AñoSemana = _t, #"Filtros preparación" = _t, Índice = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"AñoSemana", type text}, {"Filtros preparación", type text}, {"Índice", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Combine(Table.SelectRows(#"Changed Type", (inner)=> inner[AñoSemana] = [AñoSemana])[Filtros preparación], ", ")),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "isLast", each if List.Max(Table.SelectRows(#"Changed Type", (inner)=> inner[AñoSemana] = [AñoSemana])[Índice]) = [Índice] then 1 else 0),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Custom.1", each if [isLast]=1 then [Custom] else null),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom2",{"Custom", "isLast"})
in
#"Removed Columns"
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 82 | |
| 48 | |
| 36 | |
| 31 | |
| 29 |