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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Santhosh0579
Frequent Visitor

How to calculate the total number of login past 30 at previous month level

Here is the login details, for past 30 days and pat 90 days

Now i need to calculate for corresponding previous month .

 

Here are the DAX expression:

considering distinct usercount during the period he loggedin:

 

Totallogin = var t=SUMMARIZE('loggedinacc','userloggedinacc'[CountryCode],"UserDistinct",DISTINCTCOUNT(loggedinacc[UserID] ))return SUMX(t,[UserDistinct])
 
 

past 30 days:

CALCULATE([Totallogin],DATESINPERIOD(dimdate[CalendarDate],[Last selected date],-30,DAY))
 
past 90 days:
CALCULATE([Totallogin],DATESINPERIOD(dimdate[CalendarDate],[Last selected date],-90,DAY))

 

Santhosh0579_0-1678716241642.png

 

 

5 REPLIES 5
Santhosh0579
Frequent Visitor

I need to calculate total number of login by user for past 30 days. (if user login multiple times consider count as 1)

and for -90 days.

and should be shown in month level as per date slicer selecetd dates

 

@Santhosh0579 ,

try the below,

Past 30 days = CALCULATE(DISTINCTCOUNT(loggedinacc[UserID]),DATESINPERIOD(dimdate[CalendarDate],MAX(dimdate[CalendarDate]),-30,DAY))
Past 90 days = CALCULATE(DISTINCTCOUNT(loggedinacc[UserID]),DATESINPERIOD(dimdate[CalendarDate],MAX(dimdate[CalendarDate]),-90,DAY))

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Hi Arul,

Thank you so much for your quick reply.

 

We cannot consider this value  "MAX(dimdate[CalendarDate])"

We need data to calculate based on date silcer dynamically

 

For example :

If i selected date between 1st of Nov to Feb 28

Feb Month : number of login from 28feb minus 30 Days

Jan Month : Number of login from 31Jan minus 30 days

Dec Month : Number of login from 31dec minus 30 days

Nov Month : Number of login from 30nov minus 30 days

 

same for past 90 days

 

Feb Month : number of login from 28feb minus 90 Days

Jan Month : Number of login from 31Jan minus 90 days

Dec Month : Number of login from 31dec minus 90 days

Nov Month : Number of login from 30nov minus 90 days

 

 

@Santhosh0579 ,

If not above formula is not working. Can you share the sample data to look into it?

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Arul
Super User
Super User

@Santhosh0579 ,

Your ask is not quite clear. Could you explain it bit more in detail?

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.