Skip to main content
cancel
Showing results for 
Search instead 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

Reply
Demi612
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:) 
Thanks in advance!

1 ACCEPTED SOLUTION
devesh_gupta
Super User
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.

View solution in original post

2 REPLIES 2
devesh_gupta
Super User
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.

Hi @devesh_gupta  thank you for ur quick answer.!

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

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 Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

Top Solution Authors