Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Raul
Post Patron
Post Patron

New column with Group by column

Hello,

I have this table in a PowerBI file:

IdCodeDescriptionValue
1C1D1Value1
2C1D2Value2
3C1D3Value3
4C1D4X
5C2D1Value5
6C2D2Value6
7C2D3Value7
8C2D4Y
9C3D1Value9
10C3D2Value10
11C3D3Value11
12C3D4Y
13C4D1Value12
14C4D2Value13
15C4D3Value8
16C4D4X
17C5D1Value16
18C5D2Value17
19C5D3Value4
20C5D4Y

 

And I need a new column that have the D4 value of the Description  column for each group of Code column, like this:

IdCodeDescriptionValueNewColumn
1C1D1Value1X
2C1D2Value2X
3C1D3Value3X
4C1D4XX
5C2D1Value5Y
6C2D2Value6Y
7C2D3Value7Y
8C2D4YY
9C3D1Value9Y
10C3D2Value10Y
11C3D3Value11Y
12C3D4YY
13C4D1Value12X
14C4D2Value13X
15C4D3Value8X
16C4D4XX
17C5D1Value16Y
18C5D2Value17Y
19C5D3Value4Y
20C5D4YY

Which formula have I to make for this new column?

Thanks!!!!

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

Hi @Raul

 

I think this column might be close.  Just chage where I have Table4 to be the name of your table.

NewColumn = CALCULATE(
                MAX('Table4'[Value]),
                FILTER(
                    ALLEXCEPT(
                        'Table4',
                        Table4[Code]
                        ),
                    [Description]="D4"
                    )
                   )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Employee
Employee

Hi @Raul

 

I think this column might be close.  Just chage where I have Table4 to be the name of your table.

NewColumn = CALCULATE(
                MAX('Table4'[Value]),
                FILTER(
                    ALLEXCEPT(
                        'Table4',
                        Table4[Code]
                        ),
                    [Description]="D4"
                    )
                   )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thanks a lot!!

Works perfectly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.