Forum Discussion

yaya1974's avatar
yaya1974
Helper III
2 years ago

Need formula help

Hello,  I have 2 tables with absolutely nothing to create a relationship.  But I need data from the first table into the second table, filtered on data from the second table.  I have this formula but it is not returning correct value.   Can someone please help?

 

Adj = IF(ABC[Customer]="A",CALCULATE(FIRSTNONBLANK(Commodities[Adj],1),ALLEXCEPT(ABC,ABC[Model],ABC[Finish],ABC[PL Market])))

 

I've even tried using multiple filters and still same result.   I do not want to use a measure or powerquery, he needs to be a new column.

 

it is returning (0.218) for all rows.  I am expecting Jan-Jun 0.0181 and Jul-Dec 0.0242

 

Thank you!

11 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, yaya1974 

    I am glad to help you.

     

    Since there are no relationships between the tables, the formula in ALLEXCEPT in the DAX formula you provided does not achieve the result you are expecting. 

     

    Could you please provide some examples of text format data in the tables (excluding sensitive data), along with your expected results, calculation logic and special examples. Simplified pbix files would be great. 

     

     

    I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
    Best Regards,
    Fen Ling,
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • yaya1974's avatar
      yaya1974
      Helper III

      Hello,  thank you for responding.  Here is a screen shot of what I am looking for.  Unfortately I get blocked when trying to share a document.   Hope this helps.   My date columns are not "dates" they are text too btw.

       

       

      Thank you for any help!

      Lori

    • yaya1974's avatar
      yaya1974
      Helper III

      My formula works, I am getting the correct output, BUT I need it to fill in the rest of the rows.  I have color coded the rows that need filled in with the same number.  My code just needs to be corrected somehow to fill in, I just can't figure that out.

      Thank you!

    • yaya1974's avatar
      yaya1974
      Helper III

      ok.  I did sorta get it to work.  using lookupvalue.  However, the issue is from Table 1. The adj column is not filling in all the way, so I first need to get issue in table 1 fixed.  here is my dax code for adj column in table 1.  can anyone help fix this?

       

       

      Thank you!

       

      • sjoerdvn's avatar
        sjoerdvn
        Solution Sage

        mmm, didn't you say that your date columns where actually text type? If that is the case than things like MIN, MAX and EARLIER are not going to work if the date format is mmm-yy. 
        So you would need to create a proper date column first, and although you could try that in DAX, I would advice to do that in Power Query or even in the source if that's possible.