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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
NickProp28
Post Partisan
Post Partisan

Nees help on the DAX

Dear Community,

Here is the example dataset for my report, there have total 10 condition I need to apply in DAX in order to get the result.

NickProp28_0-1615514969586.png

Unique Match Column = 
var consignee=CALCULATE(DISTINCTCOUNTNOBLANK(Client[Consignee]),ALLEXCEPT(Client,Client[ConsolNumber]))
var consignor=CALCULATE(DISTINCTCOUNTNOBLANK(Client[Consignor]),ALLEXCEPT(Client,Client[ConsolNumber]))
var match=SWITCH(TRUE(),
AND(consignor=1,consignee=1),Client[Consignee],
AND(ISBLANK(consignor),consignee<>1),"BLANK",
AND(ISBLANK(consignee),consignor<>1),"BLANK",
consignee=1,Client[Consignee],
consignor=1,Client[Consignor],
"MIX")
return match
I face some problem in dax when applying the rules for C009 and C010. There have a result null because DAX is referring to the column consignee/consignor when the condition is hit. 

NickProp28_1-1615515049603.png
I would like to request some help on modify the DAX, for C009 and C010, if the consignee have only one brand name but also having null value, the result is return to the brand name without the null value. 
For example, 

 

NickProp28_0-1615515530734.png

But if there have more than one brand name with null value, the result will return 'BLANK'

For example,

NickProp28_1-1615516050934.png

Here is the pbix: https://ufile.io/l9flqncr

Appreciate any helps provided & thanks for your attention. 

1 ACCEPTED SOLUTION

@NickProp28 , done few changes. If needed you can test by reverting some >= changes

 

Unique Match Column = 
var consignee=CALCULATE(DISTINCTCOUNTNOBLANK(Client[Consignee]),ALLEXCEPT(Client,Client[ConsolNumber]))
var consignor=CALCULATE(DISTINCTCOUNTNOBLANK(Client[Consignor]),ALLEXCEPT(Client,Client[ConsolNumber]))
var consignee1=CALCULATE(Max(Client[Consignee]),ALLEXCEPT(Client,Client[ConsolNumber]))
var consignor1=CALCULATE(Max(Client[Consignor]),ALLEXCEPT(Client,Client[ConsolNumber]))
var match=SWITCH(TRUE(),
AND(consignor>=1,consignee>=1),consignee1,
consignee>=1,consignee1,
consignor>=1,consignor1,
AND(ISBLANK(consignor),consignee<>1),"BLANK",
AND(ISBLANK(consignee),consignor<>1),"BLANK",

"MIX")
return match
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@NickProp28 , I think moving last two before should help  like

 

Unique Match Column = 
var consignee=CALCULATE(DISTINCTCOUNTNOBLANK(Client[Consignee]),ALLEXCEPT(Client,Client[ConsolNumber]))
var consignor=CALCULATE(DISTINCTCOUNTNOBLANK(Client[Consignor]),ALLEXCEPT(Client,Client[ConsolNumber]))
var match=SWITCH(TRUE(),
AND(consignor=1,consignee=1),Client[Consignee],
consignee=1,Client[Consignee],
consignor=1,Client[Consignor],
AND(ISBLANK(consignor),consignee<>1),blank(),
AND(ISBLANK(consignee),consignor<>1),blank(),
"MIX")
return match
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Dear @amitchandak ,

the null value is still appear here.

NickProp28_0-1615517702488.png

 

@NickProp28 , done few changes. If needed you can test by reverting some >= changes

 

Unique Match Column = 
var consignee=CALCULATE(DISTINCTCOUNTNOBLANK(Client[Consignee]),ALLEXCEPT(Client,Client[ConsolNumber]))
var consignor=CALCULATE(DISTINCTCOUNTNOBLANK(Client[Consignor]),ALLEXCEPT(Client,Client[ConsolNumber]))
var consignee1=CALCULATE(Max(Client[Consignee]),ALLEXCEPT(Client,Client[ConsolNumber]))
var consignor1=CALCULATE(Max(Client[Consignor]),ALLEXCEPT(Client,Client[ConsolNumber]))
var match=SWITCH(TRUE(),
AND(consignor>=1,consignee>=1),consignee1,
consignee>=1,consignee1,
consignor>=1,consignor1,
AND(ISBLANK(consignor),consignee<>1),"BLANK",
AND(ISBLANK(consignee),consignor<>1),"BLANK",

"MIX")
return match
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Dear @amitchandak,

Thanks for the help. Its work!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors