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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
doubleclick
Helper II
Helper II

Dax Measure where calculate & sum are used, but want to filter table if a column contains a string

Hey all, I have a simple DAX formula in Excel Powerpivot (NOT pbi)

 

=calculate(sum(table[Sales])

 

I want to filter it so that if [X Column] contains the string "pablo", only then will the sum be calcaulted. 

 

I've tried a bunch of different methods 

For some reason 'containsstring' is not a function available

1 ACCEPTED SOLUTION
BeaBF
Solution Sage
Solution Sage

@doubleclick Try:

=
CALCULATE (
    sum(table[Sales]),
    FILTER (table, FIND ( "Pablo", Table[X Column],, 0 ) <> 0 )
)

Note that the function FIND is case-sensitive. Check this link for details:

https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/

B.

View solution in original post

1 REPLY 1
BeaBF
Solution Sage
Solution Sage

@doubleclick Try:

=
CALCULATE (
    sum(table[Sales]),
    FILTER (table, FIND ( "Pablo", Table[X Column],, 0 ) <> 0 )
)

Note that the function FIND is case-sensitive. Check this link for details:

https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/

B.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors