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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
WDHB01
Helper I
Helper I

DAX beginners question

Created this measure based on the formula below but no data is returned. The MessageStatusCode field is varchar not numeric which is why I used VALUE

"TotalTxts2 = CALCULATE( COUNTROWS('pas tbl_OPSMSSent'), FILTER(VALUES( 'pas tbl_OPSMSSent'), 'pas tbl_OPSMSSent'[MessageStatusCode] = "0" ) )"

"ColorGreen = CALCULATE( COUNTROWS(‘Demo’),   FILTER( VALUES(‘Demo'[Color]), ‘Demo'[Color] = “Green” ) )"

1 ACCEPTED SOLUTION

Thanks for reply, I posted again as wasn't getting any replies and got the solution I needed.

TotalTxts2 = CALCULATE( COUNTROWS('pas tbl_OPSMSSent'),FILTER('pas tbl_OPSMSSent',trim('pas tbl_OPSMSSent'[MessageStatusCode])="0"))

View solution in original post

7 REPLIES 7
v-easonf-msft
Community Support
Community Support

Hi, @WDHB01 

Thank you for your sharing.

If your problem has been solved, you can accept  your reply as Solution to close this thread.
More people will learn new things here.

 

Best Regards,
Community Support Team _ Eason

v-easonf-msft
Community Support
Community Support

Hi, @WDHB01 
The formula needs a small change:

 

TotalTxts2 = 
CALCULATE( 
    COUNTROWS('pas tbl_OPSMSSent'), 
    'pas tbl_OPSMSSent'[MessageStatusCode] = "0" 
) 

 

43.png

If it doesn't meet your requirement,please share  your sample data for futher research.

 

Best Regards,
Community Support Team _ Eason

Thanks for reply, I posted again as wasn't getting any replies and got the solution I needed.

TotalTxts2 = CALCULATE( COUNTROWS('pas tbl_OPSMSSent'),FILTER('pas tbl_OPSMSSent',trim('pas tbl_OPSMSSent'[MessageStatusCode])="0"))
Fowmy
Super User
Super User

@WDHB01 

 

What's your question here?

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

It should return a count of all rows that have a column value of "0"

[MessageStatusCode] = "0"

@WDHB01 

Try this please:

TotalTxts2 = 
CALCULATE( 
    COUNTROWS('pas tbl_OPSMSSent'), 
    'pas tbl_OPSMSSent'[MessageStatusCode] = 0 
) 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thanks for the reply.

 

Get error message.

Error Message:

MdxScript(Model) (4, 84) Calculation error in measure 'pas tbl_OPSMSSent'[TotalTxtsSent]: DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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