Forum Discussion

campelliann's avatar
campelliann
Post Patron
4 years ago
Solved

add columns / lookupvalue virtual Table

Hi, 

So I am trying to build a measure which returns the Last PRD Date.

The logic is this, I have a Table "RH projecto" on which I am going to add the Production date for each project "@Data_PRD". The PRD date is on Triskell completo Table, thus the need for the lookupvalue. 
Perhaps I am not building a row context or something like that?

Thanks!

Last PRD Date =
var current_project= SELECTEDVALUE(RH_projecto[ProjectID])
var tabela_virtual= ADDCOLUMNS(All(RH_projecto),"@Data_PRD", LOOKUPVALUE('Triskell Completo'[Produção],'Triskell Completo'[Processo],current_project))
return MAXX(tabela_virtual,[@Data_PRD])
  • Hi, first and foremost thank you! I have solved the problem with a calculated column. Using powerbi as excel never fails lol.

    The issue seems to be related with the model and some circular dependencies since RH table is a summarized table, this is really a mess by now. Although your tip was good I also tried Calculate(first non blank) with a blank result... But is the syntax of my measure (just for the sake of understanding) correct? In a simpler model would work?

3 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi campelliann 

    can you please share screenshots of the visual. Initially let's say that LOOKUPVALUE returns blank incase it returned multiple rows. If this is your case then you need to summarize theTriskell Completo table to same granularity of the RH_projecto table perhaps using SUMMARIZE to aggregate MAX values of the Completo'[Produção]. If you can share information I might be able to help further. Thank you and have a great day. 

    • campelliann's avatar
      campelliann
      Post Patron

      Hi, first and foremost thank you! I have solved the problem with a calculated column. Using powerbi as excel never fails lol.

      The issue seems to be related with the model and some circular dependencies since RH table is a summarized table, this is really a mess by now. Although your tip was good I also tried Calculate(first non blank) with a blank result... But is the syntax of my measure (just for the sake of understanding) correct? In a simpler model would work?

      • tamerj1's avatar
        tamerj1
        Community Champion

        Pleaseure to hear that. Yes indeed you need to have clean data and proper relationships before doing DAX. Keepup the good work. Good luck 👍