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
Daven
Helper II
Helper II

Earliest record - True/False

Hi,

 

I have a table in below format and want to see the first call of the day from the same number. 

 

Please note there can be more than one call from "blocked number" at same time anwered by different agents. In that case sort by agent name

 

Called DateTimeCalled fromAgent Expected result - First call of the day from same Number
11/01/2019 11:21:20123

A

True
11/01/2019 11:30:20123BFalse
11/02/2019 10:20:10123ATrue
11/01/2019 13:21:20456CTrue
11/03/2019 14:20:10456CTrue
11/04/2019 10:10:20BlockedATrue
11/04/2019 10:10:20Blocked CFalse

 

Thanks,

 

Daven

1 ACCEPTED SOLUTION

 Hi @Daven 

 

Add this as a calculated column:

First Call = 
VAR RowDateTime = Table1[Called DateTime]
VAR RowDate = TRUNC ( Table1[Called DateTime] )
VAR RowCalledFrom = Table1[Called from]
VAR RowAgent = Table1[Agent ]
VAR FirstCallTime =
CALCULATE (
    MIN ( Table1[Called DateTime] ),
    FILTER (
        ALL ( Table1 ),
        TRUNC ( Table1[Called DateTime] ) = RowDate
            && Table1[Called from] = RowCalledFrom
    )
)
VAR FirstAgent = 
CALCULATE (
    MIN ( Table1[Agent ] ),
    FILTER ( 
        ALL ( Table1 ),
        Table1[Called DateTime] = RowDateTime
            && Table1[Called from] = RowCalledFrom
    )
)
VAR Result = 
SWITCH (
    TRUE(),
    RowCalledFrom <> "Blocked" && RowDateTime = FirstCallTime, TRUE(),
    RowCalledFrom = "Blocked" && RowDateTime = FirstCallTime && RowAgent = FirstAgent, TRUE(),
    FALSE()
)
RETURN Result

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

View solution in original post

4 REPLIES 4
MartynRamsden
Solution Sage
Solution Sage

Hi @Daven 

 

Should the expected result in Row 3 be TRUE?

 

Best regards,

Martyn

Hi,

 

Yes the row 3 should be true. Thanks for catching it.

I updated it.

 

Daven

 

 Hi @Daven 

 

Add this as a calculated column:

First Call = 
VAR RowDateTime = Table1[Called DateTime]
VAR RowDate = TRUNC ( Table1[Called DateTime] )
VAR RowCalledFrom = Table1[Called from]
VAR RowAgent = Table1[Agent ]
VAR FirstCallTime =
CALCULATE (
    MIN ( Table1[Called DateTime] ),
    FILTER (
        ALL ( Table1 ),
        TRUNC ( Table1[Called DateTime] ) = RowDate
            && Table1[Called from] = RowCalledFrom
    )
)
VAR FirstAgent = 
CALCULATE (
    MIN ( Table1[Agent ] ),
    FILTER ( 
        ALL ( Table1 ),
        Table1[Called DateTime] = RowDateTime
            && Table1[Called from] = RowCalledFrom
    )
)
VAR Result = 
SWITCH (
    TRUE(),
    RowCalledFrom <> "Blocked" && RowDateTime = FirstCallTime, TRUE(),
    RowCalledFrom = "Blocked" && RowDateTime = FirstCallTime && RowAgent = FirstAgent, TRUE(),
    FALSE()
)
RETURN Result

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

Hi Martyn,

 

Thank you so much for your time and providing the solution. It works! 

 

Hope you have a great day!

 

Best, 

 

Daven

 

 

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.