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
abhay03
Helper I
Helper I

Selecting a cell value in power bi table visual

 

I have a table that has some errors which are logged in to another table with RowID and ColumnName.

 

Original Table:

table.PNG

 

Error Table:

error table.PNG

 

In the error table I want to create a value field and show the corresponding value that caused the error. I have the RowID and ColumnName to fetch the value for each cell in error table. Is this possible with the Table visual?

1 ACCEPTED SOLUTION

@abhay03,

 

CONTAINS ( 'Error', 'Error'[ColumnName], <Row 1 ColumnName value> ), LOOKUPVALUE ( <Row 1 TableName value>[<Row 1 ColumnName value>

We cannot use dynamic column name or table name in DAX currently. So for your scenario, I am afraid there is no a efficient DAX expression to achieve your requirement.

 

Thank you for your understanding.

 

Regards,

Charlie Liao

View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @abhay03,

 

Add a measure to your error table with this sintax:

Find_field = 
SWITCH (
    TRUE (),
    CONTAINS ( 'Error', 'Error'[ColumnName], "Name" ), LOOKUPVALUE ( Original[Name], Original[RowID], MAX ( 'Error'[RowID] ) ),    
    CONTAINS ( 'Error', 'Error'[ColumnName], "Age" ), LOOKUPVALUE ( Original[Age], Original[RowID], MAX ( 'Error'[RowID] ) ),
    CONTAINS ( 'Error', 'Error'[ColumnName], "Gender" ), LOOKUPVALUE ( Original[Gender], Original[RowID], MAX ( 'Error'[RowID] ) )
    )

 

Result is below:

column.png

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks @MFelix!

 

Your solution works well with fixed columns in table and lookup is from pre-determined table. In my case there are hundreds of columns and accordingly lookup is from different tables. I have expanded the scope of previous example:

 

Table1   
RowIDNameAgeGender
1 30Male
2EricNA
3Harper45Female

 

Table2   
RowIDAddressZipcodeState
1New york10001Others
2Indiana60001/2IL
3Illinois 46001IN

 

Table3   
RowIDItemShipDateStatus
1Pen7/13/2016Delivered
2Notepad7/14/2016In transit
3 7/15/2016Unknown

 

Error    
RowIDErrorTableNameColumnNameValue
1Name is blankTable1Name 
2Gender is invalidTable1Gender 
2Age is invalidTable1Age 
1State is invalidTable2State 
2Zipcode invalidTable2Zipcode 
3Item is blankTable3Item 
3Status is invalidTable3Status 

 

 

Here the need is to use the values dynamically in the DAX query, something like below:

CONTAINS ( 'Error', 'Error'[ColumnName], <Row 1 ColumnName value> ), LOOKUPVALUE ( <Row 1 TableName value>[<Row 1 ColumnName value> ], Original[RowID], MAX ( 'Error'[RowID] ) )

 

@abhay03,

 

CONTAINS ( 'Error', 'Error'[ColumnName], <Row 1 ColumnName value> ), LOOKUPVALUE ( <Row 1 TableName value>[<Row 1 ColumnName value>

We cannot use dynamic column name or table name in DAX currently. So for your scenario, I am afraid there is no a efficient DAX expression to achieve your requirement.

 

Thank you for your understanding.

 

Regards,

Charlie Liao

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.