cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

## How use "like"-Function or "not like" in Dax?

Hello 2gether

I have a question regarding a formula in DAX. I want to create a measure naming "m_sum_costs".

I have a column "A"  with cost-center with are digits like 699545, 745826, 406669, etc. and column "B" are values with 50.000\$, 69.56\$. Now i want to calculate all cost-center witch not begins with 6....
I thought a formula like this: m_sum_cost = Calculate (Sum(tab_actuals[values]), FILTER (tab_actuals, tab_actuals[cost_center] <> 6%))

This doesn't work.

As I am new with developing with DAX, I would be thankful i you could help me:)

1 ACCEPTED SOLUTION
Super User

@Demi612 In DAX, you can use the LEFT function to extract a specified number of characters from the beginning of a string. Here's how you can modify your measure to sum up values for cost centers that do not start with '6':

``````m_sum_costs =
CALCULATE (
SUM ( tab_actuals[values] ),
FILTER (
tab_actuals,
LEFT ( tab_actuals[cost_center], 1 ) <> "6"
)
)``````

If you find this insightful, please provide a Kudo and accept this as a solution.

2 REPLIES 2
Super User

@Demi612 In DAX, you can use the LEFT function to extract a specified number of characters from the beginning of a string. Here's how you can modify your measure to sum up values for cost centers that do not start with '6':

``````m_sum_costs =
CALCULATE (
SUM ( tab_actuals[values] ),
FILTER (
tab_actuals,
LEFT ( tab_actuals[cost_center], 1 ) <> "6"
)
)``````

If you find this insightful, please provide a Kudo and accept this as a solution.

New Member

Hi @devesh_gupta  thank you for ur quick answer.!

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

#### New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors