Forum Discussion

JamesMoody's avatar
JamesMoody
Frequent Visitor
2 years ago
Solved

Custom Column with multiple if statements

I am wanting to add a column to my data to determine when a call is abandoned. Here is my currrent formula and the result I am getting.

 

Formula:  Column = IF('Table1'[Participant] = "agent", IF('Table1'[Segment] <> "interact", "Abandoned"))

 

Current Result:

Record IDParticipantSegmentCurrent Result
1agentalertAbandoned
1ivrivr 
1acdinteract 
1acddelay 
1customerinteract 
2agentwrapupAbandoned
2agentinteract 
2agentalertAbandoned
2acdinteract 
2acddelay 
2ivrivr 
2customerinteract 

 

I would like the result to be as per below - only counting records as Abandoned if one of the participants is an 'agent' and there is only the one segment for 'alert'

 

Expected Result:

Record IDParticipantSegmentExpected Result
1agentalertAbandoned
1ivrivr 
1acdinteract 
1acddelay 
1customerinteract 
2agentwrapup 
2agentinteract 
2agentalert 
2acdinteract 
2acddelay 
2ivrivr 
2customerinteract 
  • Hi,

    Please check the below picture and the attached pbix file.

     

     

     

    Expected Result CC =
    VAR _recordid = Table1[Record ID]
    VAR _list =
        CALCULATETABLE (
            Table1,
            Table1[Record ID] = _recordid,
            Table1[Participant] = "agent",
            Table1[Segment] <> "alert"
        )
    RETURN
        IF ( COUNTROWS ( _list ) = 0 && Table1[Segment] = "alert", "Abandoned" )
    

     

2 Replies

  • Hi,

    Please check the below picture and the attached pbix file.

     

     

     

    Expected Result CC =
    VAR _recordid = Table1[Record ID]
    VAR _list =
        CALCULATETABLE (
            Table1,
            Table1[Record ID] = _recordid,
            Table1[Participant] = "agent",
            Table1[Segment] <> "alert"
        )
    RETURN
        IF ( COUNTROWS ( _list ) = 0 && Table1[Segment] = "alert", "Abandoned" )