Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DAX Distinct Count with Filter

I'm comparing 2 columns; [Ticket Number] and [Scan datetime] in the same table.

I need to find the total number of unique tickets with a scan. I came up with the following formula but not sure if its correct....

TotalAccepScan:=CALCULATE(DISTINCTCOUNT(Table_name[TICKET]),Table_name[ACCEPTANCE_DATETIME]<>BLANK())

 

  • Anonymous - I do not see anything wrong with that calculation. It is probably not how I would have structured it but because I try to avoid using CALCULATE but there is nothing wrong with it if your intention is to get a distinct count of only the TICKET's that have a SCAN_DATETIME.

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Greg_Deckler my apologies. Here is sample dataset.

      Output result: What is the count of (unique) tickets that have a scan date? My current formula is:

      Total_Tickets_With_Scan:=CALCULATE(DISTINCTCOUNT(Table_Name[TICKET]),Table_Name[SCAN_DATETIME]<>BLANK())

      Hope that made sense.

      TICKETSCAN_DATETIME
      FF16654931728/04/2020 12:52
      FF166549626 
      FF166549820 
      FF166550071 
      FF16655032928/04/2020 12:51
      FF166550394 
      FF166550403 
      FF16655044828/04/2020 16:53
      FF16655112528/04/2020 17:53
      FF166551545 

       

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion
        Anonymous - I do not see anything wrong with that calculation. It is probably not how I would have structured it but because I try to avoid using CALCULATE but there is nothing wrong with it if your intention is to get a distinct count of only the TICKET's that have a SCAN_DATETIME.