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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Arioli_Chezhian
Helper II
Helper II

Create calculated column in Live connection

Hello All,

Arioli_Chezhian_0-1693298274326.pngArioli_Chezhian_1-1693298287710.png

Arioli_Chezhian_3-1693298375803.png

I have 2 tables, Table 1 is live connection(Using existing dataset) and Table 2 is import file. The Employee ID present in import file should be shown as "Flag - Internal", and for other records should be shown as "External" or "Blank". 

We have to bring that Flag column from table 2 to table 1. Using RELATED function we can achieve this but since Table 1 is live connection unable to create Calculate column and Calculate Table.
Using relationship between these 2 table if we directly drag and drop the Flag column in a table visual, data will filtered out where Flag = Internal. Flag = External won'tbe appeared in the visual.  I believe it should be handled in Measure. 

Please advice how to achieve this measure. 

1 ACCEPTED SOLUTION

@Arioli_Chezhian  Please Try This one.

Flag =
IF (
    SELECTEDVALUE ( 'Table 1'[Emp ID] ) = MAX ( 'Table 2'[Emp ID] ),
    "Internal",
    "External"
)
Mahesh0016_0-1693313371080.pngMahesh0016_0-1693313502377.png

 

 

View solution in original post

14 REPLIES 14
Mahesh0016
Super User
Super User

@Arioli_Chezhian  Table 1 is your fact table and Table 2 is the Dimension Table, Right?

@Mahesh0016  yes, that's correct.

@Arioli_Chezhian I hope this helps you. Thank you.

Mahesh0016_0-1693303096158.png

>Create Following Measures :
Tbl1 =
SUM ( 'Table Workspace'[Emp ID] )
#################################
Tbl2 =
SUMX ( 'Table Flag', [Tbl1] )
################################
Flag =
IF ( [Tbl1] = [Tbl2], "Internal", "External" )



@Mahesh0016 
I have a correction in the data. You have done SUM for Emp ID, just for example I gave Emp ID as number but in my case the EMP ID has alphabetics with numerics. (Example: abcd324).
In this case we cannot SUM the column right, as the datatype will stay as TEXT.

How to overcome this?

@Arioli_Chezhian I hope this helps you. Thank you.

Mahesh0016_1-1693305080814.png

 

Mahesh0016_0-1693304991696.png

 

>Create Following Measures :
Tbl1 =
MAX ( 'Table Workspace'[Emp ID] )
#################################
Tbl2 =
MAXX ( 'Table Flag', [Tbl1] )
################################
Flag =
IF ( [Tbl1] = [Tbl2], "Internal", "External" )



@Arioli_Chezhian okay, I will try and let you know one more thing is your employee ID length is same, right

@Mahesh0016 
Yes it's consists of 4 alphabetics continue with 3 numerics (abcd324).

@Arioli_Chezhian it's Done Please Check my Solution. Thank You.

@Mahesh0016  - I tried but when I drag and drop this measure, the visual keeps on loading. 

@Arioli_Chezhian  are you plot columns from the fact table or Dim in visual?

@Mahesh0016 - I am bringing data from Table 1, which contains all the emp ID. Even in Table 1 it has unique records, no duplicates.

@Arioli_Chezhian  Please can you Elobrate Table 1 and Table 2 Relationships.
For E.g One To Many, One to One

@Mahesh0016  - One to One

@Arioli_Chezhian  Please Try This one.

Flag =
IF (
    SELECTEDVALUE ( 'Table 1'[Emp ID] ) = MAX ( 'Table 2'[Emp ID] ),
    "Internal",
    "External"
)
Mahesh0016_0-1693313371080.pngMahesh0016_0-1693313502377.png

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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