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
Anonymous
Not applicable

Dynamically get last date of user or category

Hi.

 

So I have a table where every time a user logs into the app, the date (a timestamp) is recorded. A rough is example is this:

 

user_iddate_login
19/1/2021
19/1/2021
19/2/2021
19/3/2021
29/3/2021
29/4/2021
19/4/2021
19/4/2021
39/4/2021
39/5/2021
39/6/2021
19/6/2021
29/6/2021
29/7/2021
29/7/2021

 

What I want to achieve is have a calculated column or measure called last_login that updates to the last date a user opened the app. So from my example, user_id 1 will have the last_login as 9/6/2021 and if he opens the app again the next day, it updates to that date.

 

How do I best do that exactly? My thoughts went to a measure because calculated columns aren't dynamic, or am I off here?

 

Much appreciated.

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could simply change the summarization type of date_login like this:

Eyelyn9_0-1630913145081.png

Or create measures:

Last login date1 = LASTDATE('Table'[date_login])
Last login date2 = MAXX(FILTER('Table','Table'[user_id]=MAX('Table'[user_id])),[date_login])

Eyelyn9_1-1630913346259.png

Best Regards,
Eyelyn Qin
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
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could simply change the summarization type of date_login like this:

Eyelyn9_0-1630913145081.png

Or create measures:

Last login date1 = LASTDATE('Table'[date_login])
Last login date2 = MAXX(FILTER('Table','Table'[user_id]=MAX('Table'[user_id])),[date_login])

Eyelyn9_1-1630913346259.png

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@Anonymous just add a simple measure like this and in the visual, drop user column and the measure:

 

Last Date = MAX ( Table[DateTime] )

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Jos_Woolley
Solution Sage
Solution Sage

Hi,

With a measure:

Last Login =
CALCULATE (
    MAX ( MyTable[date_login] ),
    ALLEXCEPT ( MyTable, MyTable[user_id] )
)

Regards

thanks!!! you really help me with this solution! 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.