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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
GSynchro
Regular Visitor

Pulling table names/if statement

Hello, so I have 4 tables: ABC, DEF, GHI, and XYZ. All tables have the same column names, but with different values. I wanted to grab the minimum of a column across ABC, DEF, and GHI. So in XYZ, I created the column

min = CALCULATE(MINX(UNION(ABC, DEF, GHI),[columnName]))

 

That worked great, but now I would like to know where that minimum came from. Is there a way to do an if statement that creates a column minTable to calculate the following process by row:

if min=ABC[columnName]

then minTable = ABC

elseif min=DEF[columnName]

then minTable = DEF

else minTable = GHI

???

 

I haven't had much luck with this, so even if your suggestion is that I set the original data up in a different way, I'll take any suggestions! Thanks!

2 REPLIES 2
Anonymous
Not applicable

HI @GSynchro ,

AFAIK, current if statement not support return table as expression result.(even if you used it in calculated table)
In addition, power bi also not support to create dynamic calculated column/table based on filter.
So I think you can't use if statement or filter to create a dynamic calculated table.

Regards,

Xiaoxin Sheng

GSynchro
Regular Visitor

Another option I tried that didn't seem to work was adding a column on each table with the table name, then appending tables ABC, GHI, and DEF, then placing [columnName] and [tableName] in a table and having [columnName] to show the minimum. I thought maybe if I sorted [columnName] from smallest to greatest in the table, that First [tableName] would return the one associated with the minimum, but that didn't work either.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.