Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Need help with DAX to get similar function LIKE in SQL

I am getting an issue in creating a DAX function in Power BI.
My Query

SELECT SUM(AMOUNT) FROM TABLE1

WHERE REVENUE_TYPE NOT LIKE '%CRA';

I want to replicate this thing in Power BI using DAX. Need some inputs
Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I tried this method and it worked for import method,

src_rev = CALCULATE(SUM(AECG_VARICENT_INCENTIVE_HISTORY[SPLIT_AMOUNT]),
              NOT(CONTAINSSTRING(AECG_VARICENT_INCENTIVE_HISTORY[REVENUE_TYPE],"CRA")))
 
Thanks for the answers and suggestions!

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

I tried this method and it worked for import method,

src_rev = CALCULATE(SUM(AECG_VARICENT_INCENTIVE_HISTORY[SPLIT_AMOUNT]),
              NOT(CONTAINSSTRING(AECG_VARICENT_INCENTIVE_HISTORY[REVENUE_TYPE],"CRA")))
 
Thanks for the answers and suggestions!
ValtteriN
Community Champion
Community Champion

Hi,

Here is an example:

ValtteriN_0-1689330643434.png

 

Dax:

SUM not cra = CALCULATE(SUM('Table (36)'[Value]),ALL('Table (36)'),'Table (36)'[Revenue type] <> "CRA")
End result:

ValtteriN_1-1689330794135.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

I understood the above concept or logic. But my issue is with the LIKE operator. How to implement that in DAX. And you can see it should filter the values starts with "CRA".

====> WHERE REVENUE_TYPE NOT LIKE '%CRA';
Not equal to would been easier but it is not!

Hi @Anonymous ,

 

You can create a DAX measure in Power BI to replicate the SQL query you provided. Here's a DAX measure that should give you the desired result:

 

Total Amount Excluding CRA = 
CALCULATE(
    SUM(TABLE1[AMOUNT]),
    FILTER(
        TABLE1,
        NOT (CONTAINSSTRING(TABLE1[REVENUE_TYPE], "CRA"))
    )
)

 

This measure calculates the sum of the AMOUNT column in TABLE1 while excluding rows where the REVENUE_TYPE contains "CRA".

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.