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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
HappyHammer15
New Member

Finding FIRSTNONBLANK with multiple filters

Hi,

 

New to PowerBI and have hit my first wall. 

I have 2 tables with a one to many relationship under Contact No. and I am trying to find the first interaction in another table based on multiple criteria. 

 

I have tried creating a new column with the following criteria which is very messy but the only way i've managed to figure something out. However, I am now getting an error that there is not enough memory to complete this operations.

 

Can someone please help me find a better way to do this?

I have tried using an array instead but get an error on multiple values when a single value was expected. 

Any help appreciated and please let me know if you need more information. 

 

 

First Interaction = calculate(
 
    firstnonblank('Interaction Log Entry'[Interaction Template Code],1),
    filter(ALL('Interaction Log Entry'),'Interaction Log Entry'[Contact No_]=Contact[No_] && 'Interaction Log Entry'[Interaction Template Code]="INORDFAIL"||'Interaction Log Entry'[Interaction Template Code]="INPHONE"||'Interaction Log Entry'[Interaction Template Code]="INLETTER"||'Interaction Log Entry'[Interaction Template Code]="INEMAIL"||'Interaction Log Entry'[Interaction Template Code]="INCONTACT"||'Interaction Log Entry'[Interaction Template Code]="INCALLBACK"||'Interaction Log Entry'[Interaction Template Code]="PHONETICKE"||'Interaction Log Entry'[Interaction Template Code]="LIVECHAT"||'Interaction Log Entry'[Interaction Template Code]="INSAVEDBAS"||'Interaction Log Entry'[Interaction Template Code]="INFAQFORM"||'Interaction Log Entry'[Interaction Template Code]="INEBROCH"||'Interaction Log Entry'[Interaction Template Code]="FACEBOOK"||'Interaction Log Entry'[Interaction Template Code]="EMAILTICKE")
    )
 
Thanks
2 REPLIES 2
HappyHammer15
New Member

@amitchandak 

Thank you for your reply. The measure worked correctly but I was hoping to have a calculated column that I could use for further visuals if possible.

A measure as I understand is limited as it doesnt associated with the rest of the table. 

I tried using the working measure to calculate a column in the Contact Table but it only returned one result for every Contact No.

HappyHammer15_0-1674665935300.png

 

Thanks again for your assistance.

amitchandak
Super User
Super User

@HappyHammer15 , In measure when you use other table you have use max or selected value

Contact

 

You can use in for multiple value, I have put some sample values 

 

example measure =

 

calculate( firstnonblank('Interaction Log Entry'[Interaction Template Code],1),
filter('Interaction Log Entry','Interaction Log Entry'[Contact No_]= max(Contact[No_]) && 'Interaction Log Entry'[Interaction Template Code] in {"INORDFAIL", "INPHONE","INLETTER","INEMAIL","INCONTACT","INCALLBACK","PHONETICKE")
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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