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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX Formula - Mismatch

Hi, 

 

Could you please create a DAX formula that shows SalesOrders that have a warehouse that doesnt match Purchasing warehouse.

 

the tables i have are: 

 

SalesOrder :

- SalesOrderNumber

- Warehouse 

 

Purchasing :

- OrderNumber

-Warehouse

 

i basically want to create a table that shows me all sale order numbers that dont match their purchasing side.

14 REPLIES 14
Anonymous
Not applicable

Hi @Anonymous , hello Ashish_Mathur  , ryan_mayu  and hnguy71 , thank you for your prompt reply!

 

Is there any progress on this issue?

 

Could you please review the PBIX file created by Ryan Mayu?

Based on my testing, it works well, just as Ryan Mayu mentioned. If it doesn't work for you, could you please upload your sample file?

 

Thank you for your understanding!

Anonymous
Not applicable

Please find some sample data, basically i want it to pick up when the warehouse doesnt match ie. it should pick up - Sales order number 265897 , 265389 , 265972 , 226594 from the data set.

SalesOrder 

Sales Order number Warehouse Purchase Order Number 
225976Direct to Customer25641
265897Direct to Customer25643
265389East25645
265972General25649
225978West 25647
226594General

25646

 

Purchasing 

Purchase order number WarehouseSales Order number 
25641Direct to Customer225976
25643General 265897
25645General 265389
25649East265972
25647West225978
25646Direct to Customer226594

@Anonymous 

you can try to create a column

 

Column =
VAR _w=maxx(FILTER(Purchasing,Purchasing[Purchase order number ]=SalesOrder[Purchase Order Number ]),Purchasing[Warehouse])
return if(_w<>SalesOrder[Warehouse ],"y")11.PNG
 
pls see the attachment below
 
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thank you, however it says : The syntax for 'return' is incorrect. (DAX(maxx(FILTER(Purchasing,Purchasing[Purchase order number ]=SalesOrder[Purchase Order Number ]),Purchasing[Warehouse])return if(_w<>SalesOrder[Warehouse ],"y"))).

could you pls provide the pbix file?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi,

This M code works

let
    Source = Table.NestedJoin(Salesorder, {"Sales Order number "}, purchasing, {"Sales Order number "}, "purchasing", JoinKind.LeftOuter),
    #"Expanded purchasing" = Table.ExpandTableColumn(Source, "purchasing", {"Warehouse"}, {"Warehouse1"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded purchasing", each ([#"Warehouse "] <> [Warehouse1]))
in
    #"Filtered Rows"

Hope this helps.

Ashish_Mathur_0-1729468258255.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi This is what i got : 

JemB123_0-1729809377889.png

 

My code has to be pasted in the Advanced Editor window which is available under View.  Ensure that the table and column names in your actual file are the same as those which are in the M code which i shared.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

thank you- how would i merge the two tables? and what is the expanded purchasing?

You are welcome.  I have already shared the M code with you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
hnguy71
Super User
Super User

Hi @Anonymous ,

To create a table that shows all the orders that does not match:

Table = CALCULATETABLE(VALUES(SaleseOrder[SaleseOrderNumber]), ISBLANK(Purshasing[OrderNumber]))


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Anonymous
Not applicable

Hi That doesnt show if the warehouses dont match. 

 

I want it to show Sale order Numbers where the purchase order number has a warehouse that doesnt match the sales order ; 

 

Sales Order 223454 - Warehouse ABC -> is matched to --> Purchase order 2345 - Warehouse xyz (so it would pick this up)

Hi @Anonymous ,

Then you would need to do the opposite. The DAX formula is essentially correct:

Table = CALCULATETABLE(VALUES(Purshasing[OrderNumber]), ISBLANK(SaleseOrder[SaleseOrderNumber]))

 
Without enough information or sample data, this is as much assistance as I can offer you.



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.