Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Comparison between two different fields on a measure

Hello PBI community,

 

I am new in power BI specialy in DAX language. I try to have my Delivery amount for each Invoice received after the delivery OR for each invoice amount different from the delivery amount.

 

i try this kind of code :

 

CALCULATE(
SUM([Delivery_amount]);
YEAR([Invoice_Date]) > YEAR([Delivery_Date]) ;[Invoice_amount]<>[Delivery_amount])

 

But i have notification that it cannot find name on Delivery_Date and Delivery_amount i don't know why cause the syntax is good for me ...

 

Sorry for my english hope i am clear and thank you in advance for your help.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    One detail all my fields are in the same table.

     

    To give you an example i want to display all the line in green :

    AccountDelivery_AmountDelivery_DateInvoice_AmountInvoice_Date
    A1002017  
    A10020171002017
    A20020171002017
    A10020171002018
    A10020171002017
    A10020171002017
    A10020171002017
    A10020171002017
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for you help v-chuncz-msft 

       

      I can add filter but the problem is i don't know why i can't put some condition like

      [Invoice_amount]<>[Delivery_amount]. Power Bi tell me that it can't find the name [Delivery_amount]. 

       

      I can do [Invoice_amount]<> 100

      or [Delivery_amount] > 100

      That work for test on numeric values but not on :

      [Invoice_amount]<>[Delivery_amount]

       

      Why ?

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Got it ! i finaly understood my mistake ! Thanks a lot