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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Self Referenzing Table with Non-Unique ID and Date Field

Hello Folks

 

I have a Table similar to this:

CallIDDateTimeCallParty
12021-01-01 10:00:23\
12021-01-01 10:00:25\
12021-01-01 10:00:28Wagner
22021-01-01 11:01:00\
22021-01-01 11:01:05Muller

 

So each Call get's an ID an i need to know who got the final Call with the same CallID which is the last with same CallID in the Order of DateTime.

 

So i would like to get 

CallIDFirstAttempDateTimeFinalDateTimeFirstCallPartyFinalCallParty
12021-01-01 10:00:232021-01-01 10:00:28\Wagner
22021-01-01 11:01:002021-01-01 11:01:05\Muller

 

Any Help is appreciatet!

 

Regards

Laurent

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Don'@laurentwagner,

You can create 4 measures as follows:

FirstAttempDateTime = 
CALCULATE (
    MIN ( 'Call'[DateTime] ),
    FILTER ( ALL ( 'Call' ), 'Call'[CallID] = MAX ( 'Call'[CallID] ) )
)
FinalDateTime = 
CALCULATE (
    MAX ( 'Call'[DateTime] ),
    FILTER ( ALL ( 'Call' ), 'Call'[CallID] = MAX ( 'Call'[CallID] ) )
)
FirstCallParty = 
MINX (
    FILTER ( 'Call', 'Call'[DateTime] = [FirstAttempDateTime] ),
    'Call'[CallParty]
)
FinalCallParty = 
MINX (
    FILTER ( 'Call', 'Call'[DateTime] = [FinalDateTime] ),
    'Call'[CallParty]
)

Self Referenzing Table with Non-Unique ID and Date Field.JPG's Looks

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

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Don'@laurentwagner,

You can create 4 measures as follows:

FirstAttempDateTime = 
CALCULATE (
    MIN ( 'Call'[DateTime] ),
    FILTER ( ALL ( 'Call' ), 'Call'[CallID] = MAX ( 'Call'[CallID] ) )
)
FinalDateTime = 
CALCULATE (
    MAX ( 'Call'[DateTime] ),
    FILTER ( ALL ( 'Call' ), 'Call'[CallID] = MAX ( 'Call'[CallID] ) )
)
FirstCallParty = 
MINX (
    FILTER ( 'Call', 'Call'[DateTime] = [FirstAttempDateTime] ),
    'Call'[CallParty]
)
FinalCallParty = 
MINX (
    FILTER ( 'Call', 'Call'[DateTime] = [FinalDateTime] ),
    'Call'[CallParty]
)

Self Referenzing Table with Non-Unique ID and Date Field.JPG's Looks

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous , Try measures like

 

FirstCallParty= firstnonblankvalue(Table[DateTime], max(Table[CallParty]))
FinalCallParty =lastnonblankvalue(Table[DateTime], max(Table[CallParty]))

 

or


FirstCallParty= calculate(firstnonblankvalue(Table[DateTime], max(Table[CallParty])), allexcept(Table, Table[CallID]))
FinalCallParty =calculate(lastnonblankvalue(Table[DateTime], max(Table[CallParty])), allexcept(Table, Table[CallID]))

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.