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
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
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.