Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

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.

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may add FILTER.

https://www.sqlbi.com/articles/filter-arguments-in-calculate/

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may add FILTER.

https://www.sqlbi.com/articles/filter-arguments-in-calculate/

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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
Not applicable

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

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors