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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply

How to count active and inactive users based on login status?

Hi guys,

 

I have the below database table based on the login status of Users on our system.

login staging.PNG

2 - Inactive 

1 - Active

 

I'm trying to count the users who logged-in (and didn't logged-in) for specific days. For simpler illustration purposes, let's take June 12 and July 12 2018 as an example (queried in database above).

 

As you can see, I selected in my filter Months June and July with the 3 users. Ideally it shouldn't count more than 3 in all of the bar chart since we only have 3 users. 

 

Basically the general rules are

1. If user is “Active” even for ONE day then we should include that user only in the “ACTIVE” user count. 
2. If the user is not all “Active” for the entire period then ONLY we should show that user in the “Inactive user” group.

 

Meaning to say, for the 12th day, it should only count 1 INACTIVE USER and not 3. My "Value" in chart is "Count of UserID".

I manage to succesfully count it in the measure in the "inactive users" and "active users" below but wasn't successful in implementing this as well in the chart.

 

Can you please help me on this one? Thanks!

chart.PNG

 

 

 

 

3 REPLIES 3
v-qiuyu-msft
Community Support
Community Support

Hi @junyetzotomayor,

 

You can create measures below: 

 

Active = CALCULATE(DISTINCTCOUNT(Table1[UserID]),FILTER(ALLSELECTED('Table1'),'Table1'[Login Status]=1&&Table1[Day]=MAX('Table1'[Day])))

 

Inactive = CALCULATE(DISTINCTCOUNT(Table1[UserID]),FILTER(ALLSELECTED(Table1),Table1[Day]=MAX('Table1'[Day])))-CALCULATE(DISTINCTCOUNT(Table1[UserID]),FILTER(ALLSELECTED('Table1'),'Table1'[Login Status]=1&& 'Table1'[Day]=MAX('Table1'[Day])))

 

 

q1.PNG

 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-qiuyu-msft,

 

Thanks for the feedback. Just a few more queries below.

 

1. I added 'Active' and 'Inactive' cards and filters in the PBI. Why is it counting only 1 inactive user wherein all users have at least logged in recordin my specifed timeframe (all dates selected).

2. Why the counts in the cards are showing different from the chart.

 

Capture.PNG

 

 

 

 

Hi @junyetzotomayor,

 

This is due to the chart has placed Day column in chart X axis, which will filter measures. While you place my measures in card visual, it process whole table and display values based on final day, in your scenario, it's 13. This is expected. 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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