Forum Discussion

WDHB01's avatar
WDHB01
Icon for Helper I rankHelper I
5 years ago
Solved

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” ) )"

  • WDHB01's avatar
    WDHB01
    5 years ago

    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"))

7 Replies

  • 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

     

    • WDHB01's avatar
      WDHB01
      Icon for Helper I rankHelper I

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

      [MessageStatusCode] = "0"
      • Fowmy's avatar
        Fowmy
        Icon for Super User rankSuper User

        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

  • v-easonf-msft's avatar
    v-easonf-msft
    Icon for Community Support rankCommunity Support

    Hi, WDHB01 
    The formula needs a small change:

     

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

     

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

     

    Best Regards,
    Community Support Team _ Eason

    • WDHB01's avatar
      WDHB01
      Icon for Helper I rankHelper I

      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"))
  • v-easonf-msft's avatar
    v-easonf-msft
    Icon for Community Support rankCommunity 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