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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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