Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help with a formula

I have a question, how can I make this formula in a data table in power Bi?
=IF(COUNTIF(NCN[Lotid],[@LOTID])>0,1,0)

 
 

I have a question, how can I make this formula in a data table in power Bi?
=IF(COUNTIF(NCN[Lotid],[@LOTID])>0,1,0)


What I want to do is the following.
A new column containing 1 or 0 according to the conditional.

If the data in the LOTID column in the Anodes table matches the LotID data of the NCNs table, then in the column put a 1
if not
put a 0

Table Anodes                                       Table NCNs

   

thanks.

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi,

    in Power Query, you have to

    merge Anodes with NCNs, in left join mode,

    expand the NCNs column in the Anodes query selecting only LotID column

    add conditional column in the Anodes query setting if NCNs.LotID = null then 0 else 1

    remove NCNs.LotID column

     

    Regards

    Lorenzo

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    in Power Query, you have to

    merge Anodes with NCNs, in left join mode,

    expand the NCNs column in the Anodes query selecting only LotID column

    add conditional column in the Anodes query setting if NCNs.LotID = null then 0 else 1

    remove NCNs.LotID column

     

    Regards

    Lorenzo

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous  thank you very much your answer helped me solve my problem.

  • Nathaniel_C's avatar
    Nathaniel_C
    Community Champion

    Hi Anonymous ,
    Try this:

     

    Lookup = IF(LOOKUPVALUE(myTable2[Column1],myTable2[Column1],myTable1[Column1],0)=0,0,1)

     

    Create a calculated column. If you substitute your tables for myTable2, and myTable1, this will work.

    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
    Nathaniel

     

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Nathaniel_C Thank  you very much for your response I found it interesting and another question arose.

      I need to add that same calculated column after week of year to the anode table, how can I do it?

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Nathaniel_C , Anonymous 
    Thank you very much for your time and help.