Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I am trying to create a calculated column that returns “yes” where any ‘Ref’ value has one or more values in ‘Code’. The data table looks like below and both ‘Ref’ and ‘Code’ are text columns. I am trying to recreate ‘RefHasCode?’ as a new column in DAX that returns either “Yes” or blank based on conditions in both 'Ref' & 'Code'.
Any ideas greatly appreciated!
Table1
| Ref | Code | RefHasCode? |
| 1 | 233 | Yes |
| 1 | 34 | Yes |
| 2 | ||
| 3 | Yes | |
| 3 | 12 | Yes |
| 1 | Yes |
Solved! Go to Solution.
Add this column to your table
Hi,
This calculated column formula works
Column = if(CALCULATE(COUNTa(Data[Code]),FILTER(Data,Data[Ref]=EARLIER(Data[Ref])&&Data[Code]<>BLANK()))>0,"Yes",BLANK())
Hope this helps.
Hi,
This calculated column formula works
Column = if(CALCULATE(COUNTa(Data[Code]),FILTER(Data,Data[Ref]=EARLIER(Data[Ref])&&Data[Code]<>BLANK()))>0,"Yes",BLANK())
Hope this helps.
You are welcome.
Add this column to your table
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.