March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Please help me create two calculated columns. They can be created in Power Query (I don't care). I would like to create new "Module_Ver 2" and "Value_Ver 2" speakers. I have explained the problem in the pictures below
Link PBIX: https://drive.google.com/file/d/1lebnBAOhJITh1b3DwQjT221upIkNVaDL/view?usp=sharing
Solved! Go to Solution.
Thanks for the reply. Previously, I also tried to use ChatGPT - gpt4, unfortunately it could not help me as in this case
Adding column Value_Ver 2 comes out nonsense:
The expected result is as follows:
Hi @Kris48
To create the two calculated columns "Module_Ver 2" and "Value_Ver 2" in Power BI, you can use the CONCATENATEX
function in DAX. Here's how you can do it:
'YourTable'
with the actual name of your table.'KeyColumn'
with the column you want to group by (e.g., an ID or date).'Module'
and 'Value'
are the columns you want to concatenate.Create a new calculated column in your table with the following DAX formula:
Module_Ver 2 =
VAR CurrentKey = 'YourTable'[KeyColumn]
RETURN
CONCATENATEX(
FILTER(
'YourTable',
'YourTable'[KeyColumn] = CurrentKey
),
'YourTable'[Module],
", "
)
Create another calculated column with this formula:
Value_Ver 2 =
VAR CurrentKey = 'YourTable'[KeyColumn]
RETURN
CONCATENATEX(
FILTER(
'YourTable',
'YourTable'[KeyColumn] = CurrentKey
),
'YourTable'[Value],
", "
)
CurrentKey
: Captures the value of the grouping key for the current row.FILTER
: Filters the table to include only rows with the same key as the current row.CONCATENATEX
: Concatenates the specified column's values (e.g., 'Module'
or 'Value'
) from the filtered table, separated by ", ".If you prefer to do this in Power Query:
Group By Key Column:
KeyColumn
).Add Custom Columns:
Add a custom column for Module_Ver 2
:
= Text.Combine([GroupedRows][Module], ", ")
Add a custom column for Value_Ver 2
:
= Text.Combine([GroupedRows][Value], ", ")
Cleanup:
'YourTable'
, 'KeyColumn'
, 'Module'
, and 'Value'
with the actual names from your dataset.By following these steps, you should be able to create the two new columns as per your requirements.
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn|Twitter|Blog |YouTube
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
26 | |
21 | |
20 | |
14 | |
10 |