cancel
Showing results for
Did you mean:
Helper I

Sum values by description that contains a common part of a string

Dear Friends,

I have the following table:

 Description Value Apple One 3 Orange One 8 Apple Two 4 Orange Two 10

I have to sum those values which contains "Two" in the description.

How can one achieve that without using a lot of CALCULATE formulas?

Thanks

2 ACCEPTED SOLUTIONS
Community Champion

Hey @gianmarco ,

I think the best approach is without any CALCULATE at all 😉

Try that one:

``````Sum contains Two =
SUMX(
myTable,
IF(
CONTAINSSTRING( myTable[Description], "two" ),
myTable[Value]
)
)``````

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Super User III
``````Sum TWO =
CALCULATE(
SUM( 'Table'[Value] ),
CONTAINSSTRING( 'Table'[Description], "TWO" )
)``````

4 REPLIES 4
Super User III
``````Sum TWO =
CALCULATE(
SUM( 'Table'[Value] ),
CONTAINSSTRING( 'Table'[Description], "TWO" )
)``````

Community Champion

Hey @gianmarco ,

I think the best approach is without any CALCULATE at all 😉

Try that one:

``````Sum contains Two =
SUMX(
myTable,
IF(
CONTAINSSTRING( myTable[Description], "two" ),
myTable[Value]
)
)``````

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Helper I

Dear @selimovd

thank you so much! Both of your formulas solve my issue! I'm gonna accept @CNENFRNL's solution as he replied me earlier. Anyway, again, thank you a lot!

Community Champion

Hey @gianmarco ,

you can also accept multiple posts as solution if they work for you 😉

But I'm happy you found a result for your problem.

Have a great weekend

Denis

Announcements

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.