Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to count 2 condition?

Now I count status Date = 2021 04 01

but I want to count status Date = 2021 04 01  and status = Complete

I have DAX as below.

Count of Implement Status Date = VAR __CurrentMeasure =
CALCULATE(
COUNTA('Update'[Status Date]),
EOMONTH('Update'[Status Date],-1)+1 = DATE(2021, 4, 1)
)
RETURN
IF ( ISBLANK ( __CurrentMeasure ), 0, __CurrentMeasure )
Please guide me  about it.
  • Hi, Anonymous 

    I am not sure how your data type in your pbix file looks like, but I think you need to have a date-type column in the table.

    Please check the below pbix file's link.

     

     

    https://www.dropbox.com/s/xbgle5ipajq5i83/adamasmay.pbix?dl=0 

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

9 Replies

  • Hi, Anonymous 

    Please try the below.

     

    Count of Implement Status Date =
    VAR __CurrentMeasure =
    CALCULATE (
    COUNTA ( 'Update'[Status Date] ),
    EOMONTH ( 'Update'[Status Date], -1 ) + 1
    = DATE ( 2021, 4, 1 ),
    'Update'[Status] = "Complete"
    )
    RETURN
    IF ( ISBLANK ( __CurrentMeasure ), 0, __CurrentMeasure )

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

    • Anonymous's avatar
      Anonymous
      Not applicable

      Jihwan_KimIt show error can't load data from image.

      It errorshow DAX not support compare date and text. Please try function Value or format for convert.

       

      Please guide me.

       

       

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Super User

        Hi, Anonymous 

        Thank you for your feedback.

        Please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

        Thanks.

    • Anonymous's avatar
      Anonymous
      Not applicable

      @Jihwan_Kim It show error can't load data from image.

      It errorshow DAX not support compare date and text. Please try function Value or format for convert.

      Please guide me.

       

       

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi Anonymous ,

    DAX not support compare date and text. Please try function Value or format for convert.

     Data Type changes to "Text": Data:Column =FORMAT('Calendar'[Date],"yyyymmyy") 

    "Text"  Type changes to Data:Column = VALUE(FORMAT(TODAY(), "YYYYMMDD"))

    If question still unsolved ,could you pls share your pbix file? Remember to remove confident data.

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien