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

Be 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

Reply
cosminc
Post Partisan
Post Partisan

DAX Column lookup in existent columns

Hello,

 

I need in DAX for a table like this to obtain Column Needed, where table is more complex with another column and i want to do this dinamically not to define in column measure Column A, B etc

 

Value Column A   Column B  Column C    Column Needed 

A           10                0                 5                  10

B            9                7                  3                  7

A            8                 5                4                  8

C           0                2                 5                  5

 

Thanks,

Cosmin

 

11 REPLIES 11
v-nuoc-msft
Community Support
Community Support

Hi @cosminc 

 

@rajendraongole1 @bhanu_gautam Thank you very much for your prompt reply.

 

Can you tell me if your problem is solved? If yes, please accept it as solution.

 

Regards,

Nono Chen

 

 

 

Hello,

unfortunately not yet

 

Thanks

Hi @cosminc 

 

Here I offer a method:

 

Go to the power query and select Custom Column in the Add Column tab.

 

vnuocmsft_0-1721112162131.png

 

 

List.Max({[ColumnA], [ColumnB], [ColumnC]})

 

 

Here is the result.

 

vnuocmsft_1-1721112220037.png

 

Regards,

Nono Chen

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

 

 

Hi,

 

thanks but i don't need max, what i need is if Value is A to return item from A column, if value is B to return the item from same row from B column
where items from column Values are corespondent with available column names; all this should be dinamically so that when it appears a Value X and a column X will not be necessary to modify the pbix.

Thanks,
Cosmin

Hi @cosminc 

 

Perhaps you could try the following:

 

Create a column.

 

Column Needed = 
var _value = 'Table'[Value]
RETURN
SWITCH(
    TRUE(),
    _value = "A", 'Table'[ColumnA],
    _value = "B", 'Table'[ColumnB],
    _value = "C", 'Table'[ColumnC]
)

 

Here is the result.

 

vnuocmsft_0-1721119030708.png

 

Regards,

Nono Chen

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

close but is not dynamic, the scenario: new items will appear, same with columns.

i need to work in this scenaro without to be necessary to modify dax

 

thanks,
Cosmin

 

cosminc
Post Partisan
Post Partisan

Hi,

but how can we do it dinamically, i don't know column names they can change

Thanks,
Cosmin

Hi @cosminc - in such cases dax formulae will not works , you can try to implment in calculate the maximum value from columns in Power BI

 

go to add column >> custom column 

List.Max(Record.ToList(Record.RemoveFields(_, {"Value"})))

rajendraongole1_0-1720606783593.png

 

I hope it works

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





rajendraongole1
Super User
Super User

Hi @cosminc - you can try below calculated column to get the max value for each column 

 

Column Needed_1 =
MAX(
    'LKP'[Column A],
    MAX(
        'LKP'[Column B],
        'LKP'[Column C]
    )
)
 
rajendraongole1_0-1720606143684.png

 

Hope it works. I am getting 9 instead of 7 as per your output. 

 

check it and let know

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





bhanu_gautam
Super User
Super User

@cosminc , It looks like you are trying to get maximum value of each table you can do that using measure which uses selectedcolumns and union

 

Column Needed =
MAXX(
UNION(
SELECTCOLUMNS(
TableName,
"Value", TableName[Column A]
),
SELECTCOLUMNS(
TableName,
"Value", TableName[Column B]
),
SELECTCOLUMNS(
TableName,
"Value", TableName[Column C]
)
),
[Value]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






no maximum

if value A from A column and so on but dinamically, column names and values can change

thanks

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.