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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
OlegV
Helper III
Helper III

Convert from sql to dax

Hi,

In SQL server there are two strings in the where clause:

'" "' (single double space double single)

'""' (single double double single)

 

Select ...

From ...

Where ColumnA <> '" "' and ColumnA <> '""'

 

How can I recreate where statement in DAX?

 

 

 

1 ACCEPTED SOLUTION
AmiraBedh
Super User
Super User

Here's how you can recreate your SQL WHERE clause in DAX:

FILTER (
TableName,
NOT (ColumnA = ' " ' ) && NOT (ColumnA = '""')
)

Or, if you are creating a measure or a calculated column, you might use an expression like this:

MeasureName = CALCULATE (
[YourCalculation],
FILTER (
TableName,
NOT (ColumnA = ' " ' ) && NOT (ColumnA = '""')
)
)

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

4 REPLIES 4
AmiraBedh
Super User
Super User

Here's how you can recreate your SQL WHERE clause in DAX:

FILTER (
TableName,
NOT (ColumnA = ' " ' ) && NOT (ColumnA = '""')
)

Or, if you are creating a measure or a calculated column, you might use an expression like this:

MeasureName = CALCULATE (
[YourCalculation],
FILTER (
TableName,
NOT (ColumnA = ' " ' ) && NOT (ColumnA = '""')
)
)

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
ftgpdx
Frequent Visitor

Assuming this is for a new measure within the report, I've generally solved this with a CALCULATE and double & for the AND. You could do something like: 

 

 

CALCULATE(
    SUM( 'Table'[Column] ),
    (NOT( 'Table'[Column A] = " ")  &&  NOT( 'Table'[Column A] = "")  )
)

 

 

Thank you for your reply.

 

Do you think that sql server string '" "' becomes " " in DAX.

And '""' becomes "" in DAX?

Check my answer 🙂


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.