Forum Discussion

Emmy66's avatar
Emmy66
Icon for Helper V rankHelper V
5 years ago
Solved

Unique monthly Login

Hi,

Could someone please assist me with this.

 

Below is my sample data.

IDTimeStamp
add727/01/2020 16:10
add728/01/2020 16:10
add725/03/2020 15:59
add709/10/2018 12:20
add727/02/2020 16:10
add729/02/2020 16:10
add715/03/2020 15:59
add716/03/2020 15:59
add717/03/2020 15:59
add718/03/2020 15:59
651915/01/2020 17:00
651916/01/2020 17:00
651917/01/2020 17:00
651918/01/2020 17:00
651924/06/2020 10:46
2ac624/01/2019 10:38
2ac625/01/2019 10:38
2ac626/01/2019 10:38
2ac627/01/2019 10:38
2ac628/01/2019 10:38
2ac628/02/2020 15:29
2ac626/05/2020 08:39
2ac623/06/2020 08:30
2ac631/07/2018 17:01
2ac605/08/2020 16:47
2ac610/09/2020 15:35
2ac631/10/2018 14:22
2ac622/11/2018 16:11
2ac620/12/2018 10:31

The proposed output is to report unique users each month rather than the number of times the user logged on. In the sample data above, add7 logged on twice in January, I want to capture it as 1 unique user for that month, also in February to be captured once and other months. Any help on this will be appreciated.

  • Emmy66 , You need to have month year column in table or in date table joined to this

     

    Columns
    Date = [TimeStamp].date
    month Year = format([TimeStamp],"YYYYMM")

     

    Then try measure 

    sumx(values(Table[month Year]), calculate(distinctcount(Table[ID])))

     

    or

    sumx(values(Date[month Year]), calculate(distinctcount(Table[ID])))

     

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

6 Replies

    • Emmy66's avatar
      Emmy66
      Icon for Helper V rankHelper V

      Hi, Thanks alot for taking the time to respond to my question. It produced the required result but the total looked weired when compared to amitchandak solution as pasted below which gives the correct total.

       

       

  • Emmy66 , You need to have month year column in table or in date table joined to this

     

    Columns
    Date = [TimeStamp].date
    month Year = format([TimeStamp],"YYYYMM")

     

    Then try measure 

    sumx(values(Table[month Year]), calculate(distinctcount(Table[ID])))

     

    or

    sumx(values(Date[month Year]), calculate(distinctcount(Table[ID])))

     

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

    • Emmy66's avatar
      Emmy66
      Icon for Helper V rankHelper V

      Hi,

      Thank you so much for the solution you provided. It worked for me. Very much appreciated.

    • Emmy66's avatar
      Emmy66
      Icon for Helper V rankHelper V

      Hi,

      One thing I forgot to ask is if I want to pass the measure thru a slicer such that the user can select start & end dates from the slicer e.g. 01/11/2019 to 31/10/2020, any idea how I can go about it please.

      • Emmy66's avatar
        Emmy66
        Icon for Helper V rankHelper V

        I managed to figure it out using variables that I created to call the date. Thanks.