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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
adinh
Frequent Visitor

Summarize rows by time and result

Hello!

 

I am trying to summarize a call log by pulling the row where the latest "Answered" result from the "Help Desk" operator occurs for each call number. If the call was not answered by anyone, the row with the latest timestamp of "No Answer" would be pulled. 

adinh_1-1727969204029.png

For example, the goal would be to pull row 457 from this call number. 

 

 

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @adinh - you can create a measure that identifies the latest timestamp for "Answered" , you can replace the table name as per your model.

LatestAnsweredTimestamp =
CALCULATE(
MAX(CallLog[Timestamp]),
FILTER(
CallLog,
CallLog[Result] = "Answered" && CallLog[Operator] = "Help Desk"
)
)

create another measure for no answer as like above without help desk condition.

LatestNoAnswerTimestamp =
CALCULATE(
MAX(CallLog[Timestamp]),
FILTER(
CallLog,
CallLog[Result] = "No Answer"
)
)

 

Now create last measure that chooses the row with the latest timestamp for "Answered" and, if no such result exists, defaults to "No Answer"

FinalTimestamp =
IF(
ISBLANK([LatestAnsweredTimestamp]),
[LatestNoAnswerTimestamp],
[LatestAnsweredTimestamp]
)

now you  can use the TopN function in DAX to pull the latest entry

TopNResult =
TOPN(
1,
CallLog,
[FinalTimestamp],
DESC

it returns the latest answered. hope the above measure helps to achieve the same.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Anonymous
Not applicable

Hi @adinh 

 

First of all, thank you rajendraongole1 for your positive reply!
Change the DAX formula for the "TopNResult" in the method provided by rajendraongole1 as follows:

 

TopNResult = 
SUMMARIZE(
    ADDCOLUMNS(
        CallLog,
        "FinalTimestamp", [FinalTimestamp]
    ),
    CallLog[NO.],
    "LatestTimestamp", MAXX(
        TOPN(
            1,
            FILTER(
                CallLog,
                CallLog[NO.] = EARLIER(CallLog[NO.])
            ),
            [FinalTimestamp],
            DESC
        ),
        [FinalTimestamp]
    ),
    "Operator", MAXX(
        TOPN(
            1,
            FILTER(
                CallLog,
                CallLog[NO.] = EARLIER(CallLog[NO.])
            ),
            [FinalTimestamp],
            DESC
        ),
        CallLog[Operator]
    ),
    "Result", MAXX(
        TOPN(
            1,
            FILTER(
                CallLog,
                CallLog[NO.] = EARLIER(CallLog[NO.])
            ),
            [FinalTimestamp],
            DESC
        ),
        CallLog[Result]
    )
)

 

 

vxianjtanmsft_0-1728267690014.png

 

Best Regards,
Jarvis Tang
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

3 REPLIES 3
rajendraongole1
Super User
Super User

Hi @adinh - you can create a measure that identifies the latest timestamp for "Answered" , you can replace the table name as per your model.

LatestAnsweredTimestamp =
CALCULATE(
MAX(CallLog[Timestamp]),
FILTER(
CallLog,
CallLog[Result] = "Answered" && CallLog[Operator] = "Help Desk"
)
)

create another measure for no answer as like above without help desk condition.

LatestNoAnswerTimestamp =
CALCULATE(
MAX(CallLog[Timestamp]),
FILTER(
CallLog,
CallLog[Result] = "No Answer"
)
)

 

Now create last measure that chooses the row with the latest timestamp for "Answered" and, if no such result exists, defaults to "No Answer"

FinalTimestamp =
IF(
ISBLANK([LatestAnsweredTimestamp]),
[LatestNoAnswerTimestamp],
[LatestAnsweredTimestamp]
)

now you  can use the TopN function in DAX to pull the latest entry

TopNResult =
TOPN(
1,
CallLog,
[FinalTimestamp],
DESC

it returns the latest answered. hope the above measure helps to achieve the same.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





HI @rajendraongole1,
This puts me in the right direction, but it seems to only track the latest call for the entire dataset instead of pulling the latest time for each call number (column NO.) 

adinh_0-1728050495903.png

There should be a row for every call logged. Would the SUMMARIZE function work instead?

Anonymous
Not applicable

Hi @adinh 

 

First of all, thank you rajendraongole1 for your positive reply!
Change the DAX formula for the "TopNResult" in the method provided by rajendraongole1 as follows:

 

TopNResult = 
SUMMARIZE(
    ADDCOLUMNS(
        CallLog,
        "FinalTimestamp", [FinalTimestamp]
    ),
    CallLog[NO.],
    "LatestTimestamp", MAXX(
        TOPN(
            1,
            FILTER(
                CallLog,
                CallLog[NO.] = EARLIER(CallLog[NO.])
            ),
            [FinalTimestamp],
            DESC
        ),
        [FinalTimestamp]
    ),
    "Operator", MAXX(
        TOPN(
            1,
            FILTER(
                CallLog,
                CallLog[NO.] = EARLIER(CallLog[NO.])
            ),
            [FinalTimestamp],
            DESC
        ),
        CallLog[Operator]
    ),
    "Result", MAXX(
        TOPN(
            1,
            FILTER(
                CallLog,
                CallLog[NO.] = EARLIER(CallLog[NO.])
            ),
            [FinalTimestamp],
            DESC
        ),
        CallLog[Result]
    )
)

 

 

vxianjtanmsft_0-1728267690014.png

 

Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.