Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

DAX Measure

I am looking for Measure where I need COUNT of sessionId, where recordingId is not blank and examId is blank.
Do we use COUNTAX and COUNTBLANK toge

 

 

  • Hey Anonymous ,

     

    you can just use a CALCULATE and change the filter context for what you want:

    Count Measure =
    CALCULATE(
        COUNT( myTable[SessionID] ),
        myTable[recordingID] <> BLANK() && myTable[examId] = BLANK()
    )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     

     

3 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey Anonymous ,

     

    you can just use a CALCULATE and change the filter context for what you want:

    Count Measure =
    CALCULATE(
        COUNT( myTable[SessionID] ),
        myTable[recordingID] <> BLANK() && myTable[examId] = BLANK()
    )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you, Denis! That worked well and is efficient.
    I also tried using FILTER instead and that was too long.

    • selimovd's avatar
      selimovd
      Most Valuable Professional

      Hey Anonymous ,

       

      you could also use filter. In this case you will just get a value if this combination is valid.

      Check it out:

      Count Measure =
      CALCULATE(
          COUNT( myTable[SessionID] ),
          FILTER( myTable, myTable[recordingID] <> BLANK() && myTable[examId] = BLANK() )
      )

       

      If you need any help please let me know.
      If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
       
      Best regards
      Denis