Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Filtered Distinct Count with CALCULATE not working as intended

Hi,   I have one table named Query1 in my Power BI report which has about 4 million rows of data and it looks a bit like this: CustomerID Login Date Country Level Highest Level ABC 10/1...
  • amitchandak's avatar
    4 years ago

    Anonymous , Please check date does not have any timestamp. Change datatype to datetime and choose a format with time and check. If there is a timestamp, then create date only column

     


    Date = [datetime].date
    or
    Date = date(year([datetime]),month([datetime]),day([datetime]))

     

     

    also, try with filter

    Days Spent on L1 = CALCULATE( DISTINCTCOUNT (Query1[Login Date] ), filter( Query1, Query[ Level] = "1" ))

    Days Spent on L2 = CALCULATE( DISTINCTCOUNT (Query1[Login Date] ), filter( Query1, Query[ Level] = "2" ))

    Days Spent on L3 = CALCULATE( DISTINCTCOUNT (Query1[Login Date] ), filter( Query1, Query[ Level] = "3" ))