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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
dwel0120
Helper III
Helper III

If Statement User Activity in Past Week based on Number of Logins

I am trying to mark a 1 in a new column IF the "user" has logged in 6 to 7 times (based on the Last Time Logged in Column) in the past 7 days from the "date of data" column (if not then 0). I also need to do this for 4 to 5 times logged in and 2 to 3 but if I get the 6-7 times then I can figure out the rest. I'm getting stuck on how to build the formula in DAX. 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @dwel0120 

Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

All measures are in the sample pbix file, and you can follow the steps that are numbered in front of the measure name.

 

Picture2.png

 

 

https://www.dropbox.com/s/0u8fmytn88xbpag/dwel.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Linkedin: https://www.linkedin.com/in/jihwankim1975/


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @dwel0120 

Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

All measures are in the sample pbix file, and you can follow the steps that are numbered in front of the measure name.

 

Picture2.png

 

 

https://www.dropbox.com/s/0u8fmytn88xbpag/dwel.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Linkedin: https://www.linkedin.com/in/jihwankim1975/


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
amitchandak
Super User
Super User

@dwel0120 , try a new column like

if(countx(filter(table, [user] =earlier([user]) && [date of data] >=earlier([date of data]) -7 && [date of data] <= earlier([date of data])), user)+0>6,1,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak That did not work. I still have 1s throughout the data and it is not limited to the past seven days from Date of Data. 

6-7 Days = if(countx(filter('All', 'All'[Last LMS Activity Completed] =earlier([Last LMS Activity Completed]) && [Date of Data] >=earlier([Date of Data]) -7 && [Date of Data] <= earlier([Date of Data])), 'All'[Last LMS Activity Completed])+0>6,1,0)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.