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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
hpayne93
Frequent Visitor

SUMX, and filter where 2 different columns containstring

Hi,
 
I need to calculate the total number of website log ins by adding the number of 'GA4 Sessions'[data.event_count] where the [pagetitle] contains "login" OR the [event_name] contains "login".
 
Can you tell me where I'm going wrong? 
 
Thanks!
 
 
Logins = SUMX(
    FILTER(
        'GA4 Sessions',
        CONTAINSSTRING('GA4 Sessions'[data.event_name], "login") || CONTAINSSTRING('GA4 Sessions'[data.pagetitle], "login",
'GA4 Sessions'[data.event_count]))))
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @hpayne93,

It seems like you missed the right brackets of the second CONTAINSSTRING function, you can try to use following measure formula if helps:

Logins =
SUMX (
    FILTER (
        'GA4 Sessions',
        CONTAINSSTRING ( 'GA4 Sessions'[data.event_name], "login" )
            || CONTAINSSTRING ( 'GA4 Sessions'[data.pagetitle], "login" )
    ),
    'GA4 Sessions'[data.event_count]
)

In addition, if you are check different fields with the same conditions at the same time, you can try or concatenate them and search the concatenate strings:

Logins =
SUMX (
    FILTER (
        'GA4 Sessions',
        SEARCH ( "login", [data.event_name] & "," & [data.paetitle], 1 ) > 0
    ),
    'GA4 Sessions'[data.event_count]
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @hpayne93,

It seems like you missed the right brackets of the second CONTAINSSTRING function, you can try to use following measure formula if helps:

Logins =
SUMX (
    FILTER (
        'GA4 Sessions',
        CONTAINSSTRING ( 'GA4 Sessions'[data.event_name], "login" )
            || CONTAINSSTRING ( 'GA4 Sessions'[data.pagetitle], "login" )
    ),
    'GA4 Sessions'[data.event_count]
)

In addition, if you are check different fields with the same conditions at the same time, you can try or concatenate them and search the concatenate strings:

Logins =
SUMX (
    FILTER (
        'GA4 Sessions',
        SEARCH ( "login", [data.event_name] & "," & [data.paetitle], 1 ) > 0
    ),
    'GA4 Sessions'[data.event_count]
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Great - worked perfectly. Thanks for your help!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.