Forum Discussion
OceanExplorer
1 year agoHelper I
How to create a new column like a self-join in SQL?
Hello, I have this original data table T1 using DirectQuery mode: I want to create a table visual to show for the same ID, when Action is 'End', who is the Staff that previously 'Start' OR 'Tr...
- 1 year ago
Assuming the blanks in T1[Staff Name] are nulls, you can use the following measure:
Started Staff = CALCULATE( FIRSTNONBLANK( T1[Staff Name], T1[Staff Name] ), ALL( T1[Action] ) )In a table where you set filter of T1[Action] = End:
- Anonymous1 year ago
Hi OceanExplorer ,
Thank you MarkLaf for the helpful response!
I tried to recreate it on my local with the sample data.So that I used below measure to create a calculated column:Started Staff =VAR CurrentID = T1[ID]VAR StaffName =CALCULATE(LASTNONBLANK(T1[Staff Name], 1),FILTER(T1,T1[ID] = CurrentID &&T1[Action] IN {"Start", "Transfer"}))RETURNIF(T1[Action] = "End", StaffName)
Here is the screenshot and pbix for your reference:
If this solution meets your requirement,consider accepting it as solution.
Thank you for being a valued member in Microsoft Fabric Community Forum!
Regards,
Pallavi.
MarkLaf
1 year agoSuper User
Assuming the blanks in T1[Staff Name] are nulls, you can use the following measure:
Started Staff =
CALCULATE(
FIRSTNONBLANK( T1[Staff Name], T1[Staff Name] ),
ALL( T1[Action] )
)
In a table where you set filter of T1[Action] = End: