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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
jiangxm80
Helper I
Helper I

Add one more columns

I would like to add one more columns, which would be equal to the first line of each set of records.

 

Column1   Column2    Column3

A                RV              100

A                AB                80

A                AB                30

B                RV               200

B                AB               120

B                AB                70 

 

Would expect:

Column1   Column2    Column3   Column4

A                RV              100             100

A                AB                80             100

A                AB                30             100

B                RV               200             200

B                AB               120             200

B                AB                70              200

 

Thanks a lot!

1 ACCEPTED SOLUTION

Hi @jiangxm80 ,

 

For the first question, you can try:

result = 
VAR _FIRST=CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Column1]))
RETURN LOOKUPVALUE('Table'[Column3],'Table'[Index],_FIRST)

As for the second question that use the RV:

You can try this method:

New column:

Column =
CALCULATE (
MAX ( 'Table'[Column3] ),
FILTER (
'Table',
'Table'[Column2] = "RV"
&& 'Table'[Column1] = EARLIER ( 'Table'[Column1] )
)
)

The result is:

vyinliwmsft_0-1668155586971.png

 

 

Hope this helps you. Here is my PBIX file.

 

 

 

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Thennarasu_R
Responsive Resident
Responsive Resident

Hi,
@jiangxm80 
Try This one
Measure=Calculate(Max(Column3 ),ALLEXCEPT(Column1))


Thanks,
Thennarasu

 

could you please help me a little bit on this? Thanks

Hi @jiangxm80 ,

 

For the first question, you can try:

result = 
VAR _FIRST=CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Column1]))
RETURN LOOKUPVALUE('Table'[Column3],'Table'[Index],_FIRST)

As for the second question that use the RV:

You can try this method:

New column:

Column =
CALCULATE (
MAX ( 'Table'[Column3] ),
FILTER (
'Table',
'Table'[Column2] = "RV"
&& 'Table'[Column1] = EARLIER ( 'Table'[Column1] )
)
)

The result is:

vyinliwmsft_0-1668155586971.png

 

 

Hope this helps you. Here is my PBIX file.

 

 

 

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, could I set the logic to get value via Column2, which is RV? 

MahyarTF
Memorable Member
Memorable Member

Hi,

This is my solution :

1) create another table based on the existing table as below :

NewTableName = SUMMARIZE(TableName, TableName[Column1]
                      , "Column4", max(TableName[Column3])
                    )
2) Make a relationship between two tables based on the Column1
3) Then bring the Column1, Column2,Column3 from first table and Column4 from second one (put the all value on 'Don't summarize'
MahyarTF_0-1668139403390.png

 

Appreciate your Kudos and please mark it as a solution if it helps you.

Mahyartf

Thanks, could I set the logic to get value via Column2, which is RV? 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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