Forum Discussion
Sum and partial match
I want to sum partial match. Below formula works fin but I want to add more criteria. When counting for partial match I use IN {"criteria1", "criteria2"} - this is not working in this case. THX
| Net Invoiced Quantity in Base UOM | Product Name |
| 5 | huuuh Combi Port E D-X KL26 |
| 10 | MLC |
| 15 | MLC762 |
= CALCULATE(SUM(Salg[Net Invoiced Quantity in Base UOM]), SEARCH("Combi Port E D-X", Salg[Product Name],,0)>0)
Hi , Anonymous
"Search" returns the number of the character at which a specific character or text string is first found, reading left to right. Search is case-insensitive and accent sensitive.
Here you can use "CONTAINSSTRING" function to indicate whether one string contains another string.
measure1 = CALCULATE ( SUM ( Salg[Net Invoiced Quantity in Base UOM] ), CONTAINSSTRING ( Salg[Product Name], "Combi Port E D-X" ) || CONTAINSSTRING ( Salg[Product Name], "Test" ) )Best Regards,
Community Support Team _ Eason
6 Replies
- amitchandakSuper User
Anonymous , what do mean by partial match here. Not able to get that. Please explain with an example
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
- AnonymousNot applicable
amitchandak By partial match I mean the text strings might be:
"hhgyj Combi Port E D-X jjij""UFH Combi Port E D-X ccc"
So by partial match I mean all strings including "Combi Port E D-X"
Hope it makes sense.
- amitchandakSuper User
Anonymous , search should have worked in that case
= CALCULATE(SUM(Salg[Net Invoiced Quantity in Base UOM]), filter(Salg, SEARCH("Combi Port E D-X", Salg[Product Name],,0)>0))
If there is more than one such string/search, You need to give with || (or) or && (and) search more then once
- AnonymousNot applicable
I have add a simple table to show what I mean by partial match amitchandak
- v-easonf-msftCommunity Support
Hi , Anonymous
"Search" returns the number of the character at which a specific character or text string is first found, reading left to right. Search is case-insensitive and accent sensitive.
Here you can use "CONTAINSSTRING" function to indicate whether one string contains another string.
measure1 = CALCULATE ( SUM ( Salg[Net Invoiced Quantity in Base UOM] ), CONTAINSSTRING ( Salg[Product Name], "Combi Port E D-X" ) || CONTAINSSTRING ( Salg[Product Name], "Test" ) )Best Regards,
Community Support Team _ Eason