IF Dax function to use as measure rather than column

Hi,

I wanted to show in my report for country code ( CAN, USA) dynamically interact with the data upon selection. Based on

Country code=  If (delivery[deliverysite_ country]= “CAN” && delivery[receiptsite_country] = “CAN”, “CAN”
If (delivery[deliverysite_ country]= “USA” && delivery[receiptsite_country] = “USA”, “USA”))

When I created this column in my fact table and used this as filter for selection it is showing blank records for those which falls under international( CAN-USA; USA-CAN) which I don’t want it to show. I want to hide those international records.

I would really appreciate if you help me with this problem.

I can’t imagine this is too difficult but it’s hard to see the issue just with the formula.

It could be a data, data model or relationship issue maybe, but can’t be sure.

Are you able to setup a demo model with the scenario you are dealing with. That would make it easier to understand everything that could be at play here.

Are you also sure within your IF function you are taking into account every combination that could be possible with the country code within those two columns. To me it just looks like you are only managing if the codes are CAN/CAN and USA/USA not the other combinations you mentioned.

You could also use a SWITCH/TRUE technique here which is much cleaner in my view when working with logic like this.

See below for more details.

Sam