Forum Discussion

karthickpbi's avatar
karthickpbi
Icon for Helper I rankHelper I
4 years ago
Solved

Power BI Report

Scenario -1

IDDate Name DirectionExpected Result 
1Jul-04AgentOutboundConsider
1Jul-04Customer AInbound 
1Jul-04AgentOutboundConsider
1Jul-04Customer AInbound 

In Scenario 1 , we need to consider One Inbound and One outbound Respectuly. 

 

Scenario-2

IDDateNameDirectionExpected Result
1Jul-04AgentOutboundconsider
1Jul-04Customer AInbound 
1Jul-04Customer AInbound 
1Jul-04Customer AInbound 
1Jul-04AgentOutboundNot consider

In Scenario 2, if we have Multiple Inbound  We nee to consider only One  bound for Respective One Outbound, other wise no need to consider outbound

Scenario-3

IDDateNameDirectionExpected Result
106-07-2004AgentOutboundConsider
106-07-2004Customer AInbound 
106-07-2004Customer AInbound 
105-07-2004Customer AInbound 
104-07-2004AgentOutbound Not consider
104-07-2004AgentOutbound Not consider
104-07-2004AgentOutbound Not consider
104-07-2004Customer AOutboundConsider
103-07-2004Customer AInbound 
103-07-2004Customer AOutboundNot Consider

 

IDDateName DirectionExpected Result
104-07-2004AgentOutboundConsider
103-07-2004Customer AInbound 
102-07-2004Customer AInbound 
101-07-2004Customer AInbound 

 

IDDateName direction Expected Result
104-07-2004Customer AOutboundNot consider
103-07-2004Customer AOutbound Not consider
102-07-2004Customer AOutbound Not consider
101-07-2004Customer AOutbound Not consider

If we need to consider outbound if we have a Inbound in below record , also if we have multiple Inbound and Multiple outbound,

here we need to consider one outbound for respective one inbound.

 

Could you Please check and share us the solution 

 

Thanks in Advance.

  • Hi karthickpbi ,

     

    In scenario -1, please try following DAX:

    Expected Result = SWITCH(
        TRUE(),
        'Scenario -1'[Name]="Agent","Consider"
        )

     

    In scenario -2, Please create an index column from 1 to 5 first, then try following DAX:

    Expected Result = SWITCH(
        TRUE(),
        'Scenario-2'[Name] = "Agent" && 'Scenario-2'[Index] = MIN('Scenario-2'[Index]),"Consider",
        'Scenario-2'[Name] = "Agent" && 'Scenario-2'[Index] > MIN('Scenario-2'[Index]),"Not Consider"
    )

     

    In scenario -3(1), please try following DAX:

    Expected Result = SWITCH(
        TRUE(),
        'Scenario-3(1)'[Direction]="Inbound",BLANK(),
        'Scenario-3(1)'[Name]= "Agent" && 'Scenario-3(1)'[Date]=MAX('Scenario-3(1)'[Date]),"Consider",
        'Scenario-3(1)'[Name]= "Agent" && 'Scenario-3(1)'[Date]<MAX('Scenario-3(1)'[Date]),"Not Consider",
        'Scenario-3(1)'[Name]= "Customer A" && 'Scenario-3(1)'[Date]= MIN('Scenario-3(1)'[Date]),"Not Consider",
        'Scenario-3(1)'[Name]= "Customer A" && 'Scenario-3(1)'[Date]> MIN('Scenario-3(1)'[Date]),"Consider"
    )

     

    In scenario -3(2), please try following DAX:

    Expected Result1 = SWITCH(
        TRUE(),
        'Scenario-3(2)'[Name]= "Agent" && 'Scenario-3(2)'[Date]=MAX('Scenario-3(2)'[Date]),"Consider"
    )

     

    In scenario -3(3), please try following DAX:

    Expected Result = SWITCH(
        TRUE(),
        COUNTROWS(FILTER('Scenario-3(3)','Scenario-3(3)'[Direction]="Inbound"))=0,"Not Consider"
    )

     

    Best Regards,

    Yadong Fang

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

3 Replies

  • v-yadongf-msft's avatar
    v-yadongf-msft
    Icon for Community Support rankCommunity Support

    Hi karthickpbi ,

     

    In scenario -1, please try following DAX:

    Expected Result = SWITCH(
        TRUE(),
        'Scenario -1'[Name]="Agent","Consider"
        )

     

    In scenario -2, Please create an index column from 1 to 5 first, then try following DAX:

    Expected Result = SWITCH(
        TRUE(),
        'Scenario-2'[Name] = "Agent" && 'Scenario-2'[Index] = MIN('Scenario-2'[Index]),"Consider",
        'Scenario-2'[Name] = "Agent" && 'Scenario-2'[Index] > MIN('Scenario-2'[Index]),"Not Consider"
    )

     

    In scenario -3(1), please try following DAX:

    Expected Result = SWITCH(
        TRUE(),
        'Scenario-3(1)'[Direction]="Inbound",BLANK(),
        'Scenario-3(1)'[Name]= "Agent" && 'Scenario-3(1)'[Date]=MAX('Scenario-3(1)'[Date]),"Consider",
        'Scenario-3(1)'[Name]= "Agent" && 'Scenario-3(1)'[Date]<MAX('Scenario-3(1)'[Date]),"Not Consider",
        'Scenario-3(1)'[Name]= "Customer A" && 'Scenario-3(1)'[Date]= MIN('Scenario-3(1)'[Date]),"Not Consider",
        'Scenario-3(1)'[Name]= "Customer A" && 'Scenario-3(1)'[Date]> MIN('Scenario-3(1)'[Date]),"Consider"
    )

     

    In scenario -3(2), please try following DAX:

    Expected Result1 = SWITCH(
        TRUE(),
        'Scenario-3(2)'[Name]= "Agent" && 'Scenario-3(2)'[Date]=MAX('Scenario-3(2)'[Date]),"Consider"
    )

     

    In scenario -3(3), please try following DAX:

    Expected Result = SWITCH(
        TRUE(),
        COUNTROWS(FILTER('Scenario-3(3)','Scenario-3(3)'[Direction]="Inbound"))=0,"Not Consider"
    )

     

    Best Regards,

    Yadong Fang

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