Forum Discussion

AhmedIqbal's avatar
AhmedIqbal
Frequent Visitor
6 years ago
Solved

If condition based on different tables in power bi

Hello, 
I am currently working on a dashboard for Accounts Payable. This is to show the live statistics of invoices and who they are allocated to. The invoices are allocated to analysts per the company code. However, If a company code received high volume of invoices, they are reallocated per the document ID (Invoice). I would like to create a column to state that if a value is present in the reallocation column, then use the reallocation name instead of the analyst in charge of the company code. Please advise if this approach is feasible or if there are any other solutions to resolve this. Thank you!

 

 

  • BA_Pete's avatar
    BA_Pete
    6 years ago

    Hi AhmedIqbal ,

     

    This is because you have also changed your Cross Filter direction between Allocation and Supplier to 'Single' in your file, whereas it was 'Both' in the screenshot you provided.

     

    Pete

12 Replies

  • Have you tried to add the  Power Query code for your condition, if so, where are you stuck?

     

    Note: 1:1 relationships are ususally a sign that the tables can be combined/merged.  Is that true in your scenario?

     

  • Hi AhmedIqbal ,

     

    Try the following measure:

    finalAnalyst =
    IF(
      ISBLANK(Reallocation[Reallocation Analyst]),
      Allocation[Analyst]
    )

     

    Pete 

    • AhmedIqbal's avatar
      AhmedIqbal
      Frequent Visitor

      Hey Pete, 
      I'm getting this error when I used the below formula.

       

      • BA_Pete's avatar
        BA_Pete
        Icon for Super User rankSuper User

        Hi AhmedIqbal ,

         

        Sorry, I wasn't in front of my computer when I sent that measure. Try this one:

        finalAnalyst = 
        IF(
          ISBLANK(MAX(Reallocation[Reallocation Analyst])),
          MAX(Allocation[Analyst]),
          MAX(Reallocation[Reallocation Analyst])
        )

         

        I get this output:

         

         

        Pete