Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Creating a column using two separate columns from different query.

Hello,

 

I have been trying to figure out how I can create a column that are based off of he date from 2 seperate columns that come from 2 seperate querys.

 

Example 

 Query/table 1                              Query /table 2                    

ID #                                             ID # a2

inital test                                      final test 2

columm x                                     columm y

 

Desired result (this table is visualizaton table created from multiple Tables )

 

ID #                     inital test                           Final test                                Status 

123                      pass                                   "blank"                                 In-process

124                      "blank"                               "blank"                                 "blank"                                          

125                      pass                                     pass                                     Ready

 

 

 

I need to create column in a table that says 

If  ID number passes final test it is ready if ID passes inital but final is blank than in process. 

 

These two query are link to a third quarey by ID# so it did not alow me to creat a realtionship to each other.

Both Inital test and Final test are created based on other colmns with in their query/tables. 

 

Can someone help with this? 

 

 

 

 

 

  

  • Anonymous's avatar
    Anonymous
    6 years ago

    why don't you merge two tables based on id's.

     

    Then create calculated column for status.

     

    Thanks & regards,
    Pravin Wattamwar
    www.linkedin.com/in/pravin-p-wattamwar

    If I resolve your problem Mark it as a solution and give kudos.

  • Anonymous's avatar
    Anonymous
    6 years ago

    az38 Anonymous 

     

    So Feeling really stupid but I was able to just merge the columns and make it work. Sorry it only my 3week uring power bi now and Thank you both for all teh help. 

11 Replies

  • az38's avatar
    az38
    Community Champion

    Hi Anonymous 

    try a LOOKUPVALUE() function, like

    Status = 
    var _initialStatus = LOOKUPVALUE('Table1'[initial test], [ID #], [ID #])
    var _finalStatus = LOOKUPVALUE('Table2'[final test], [ID #], [ID #])
    RETURN
    SWITCH(true(),
    NOT(ISBLANK(_finalStatus)), "Ready",
    NOT(ISBLANK(_initialStatus )) && ISBLANK(_finalStatus), "In-process",
    BLANK()
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      When i attempted this i got an error code 

      "A table of multiple values was supplied where a single value was expected."

       

       

      When I creates a column using lookup it only  transfered data for ID that final had and notthat ones that inital bad but final didnt.

       

      • az38's avatar
        az38
        Community Champion

        Anonymous 

        have you got any duplicated [ID #] value in your tables?