cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kh0050
Frequent Visitor

Count - Date Range

Hi All
See the table below, I need to count the number of days access ( using DaysAccessed) by each student in the last 3 months or 90days. Can you help me either to create a measure or calculated column DAX expressions? 

 

UserId    DayAccessedCount of Days Access
kh0078   2020-12-13T00:00:00.0000000Z 
SB7655   2021-05-14T00:00:00.0000000Z 
kh0078   2021-01-06T00:00:00.0000000Z 
SB7655   2021-05-06T00:00:00.0000000Z 
kh0078   2021-05-16T00:00:00.0000000Z 
SB7655   2021-05-13T00:00:00.0000000Z 
kh0078   2021-03-12T00:00:00.0000000Z 
kh0078   2021-04-11T00:00:00.0000000Z 

 

Thanks

1 ACCEPTED SOLUTION
yingyinr
Community Support
Community Support

Hi @kh0050 ,

You can create a measure as below:

 

Count of Days Access = 
CALCULATE (
    COUNT ( 'Table'[UserId] ),
    FILTER (
        'Table',
        'Table'[DayAccessed]
            >= TODAY () - 90
            && 'Table'[DayAccessed] <= TODAY ()
    )
)

 

yingyinr_0-1621407780732.png

Best Regards

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

View solution in original post

4 REPLIES 4
yingyinr
Community Support
Community Support

Hi @kh0050 ,

You can create a measure as below:

 

Count of Days Access = 
CALCULATE (
    COUNT ( 'Table'[UserId] ),
    FILTER (
        'Table',
        'Table'[DayAccessed]
            >= TODAY () - 90
            && 'Table'[DayAccessed] <= TODAY ()
    )
)

 

yingyinr_0-1621407780732.png

Best Regards

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

View solution in original post

kh0050
Frequent Visitor

@yingyinr -Thank you for your help. What if the student is enrolled in multiple courses and I need to have reports of his/her visits to each course in the last 90days or 3 months then how I will do that please? 

amitchandak
Super User IV
Super User IV

@kh0050 , with help from a date table, joined day accessed

 

Rolling 3 = CALCULATE(count(Table[day accessed ]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

 

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.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Hi Amit 

 

Thank you again for helping me out. Please check below the date column I have created and is it correct? 

 

Date =
ADDCOLUMNS (
CALENDARAUTO(),
"Year", YEAR ( [DATE] ), "Month", FORMAT( [DATE],"mmmm" ))

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Top Solution Authors
Top Kudoed Authors