Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Emmy66
Helper IV
Helper IV

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.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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.

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@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.

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.

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

Hi,

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

mahoneypat
Employee
Employee

Just create a simple measure like this and use it in a visual with a MONTH( ) column created from your Date column.  Or even, make a Date table for your model and relate it on Date.

 

Unique Users = DISTINCTCOUNT(Table[ID])

 

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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_0-1605782122771.png

 

Emmy66_1-1605782251831.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.