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
ansa_naz
Continued Contributor
Continued Contributor

Query editor question - count number of valid email attachments

Hi all

 

Is there any way for me to count the number of valid attachments within an email in Query Editor?  To do that, I need to ignore the header logo, footer logo, other random bits of garbage that show up as attachments on the email. So I need to count the number of attachments where the 'ContentType' field starts with 'Application'

 

I have aggregated the Attachments column by count of Attachment Name, but I want to add in a condition where the COUNT will only include attachments where the 'ContentType' of the attachment begins with 'Application' - how can I do this please?

 

My query is currently like this:

 

let
    Source = Exchange.Contents("XXX@XXX.co.uk"),
    Mail1 = Source{[Name="Mail"]}[Data],
    #"Filtered Rows" = Table.SelectRows(Mail1, each ([Folder Path] = "\Inbox\Purchase Ledger\Invoices\In Query\" or [Folder Path] = "\Inbox\Purchase Ledger\Invoices\New\" or [Folder Path] = "\Inbox\Purchase Ledger\Statements\New\")),
    #"Aggregated Attachments" = Table.AggregateTableColumn(#"Filtered Rows", "Attachments", {{"Name", List.NonNullCount, "Count (Not Blank) of Attachments.Name"}})
in
    #"Aggregated Attachments"

 

Many thanks for all help

1 REPLY 1
ansa_naz
Continued Contributor
Continued Contributor

Found a different way to do this

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.