March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have data set with 2 columns - Week and User. Data indicates weeks when users have been part of certain group. I would like to create new column (New User) that will compare Week with previous week. If the user is not found in a previous week, I'd like to return "Yes". If user can be found in table in previous week, I'd like to return "No".
Example: For Week 2 I'd like to see "Yes" for John as there is no data showing John was part of the group in Week 1. For Week 3, I'd like to see "No" because John was part of a group in Week 2.
Hope it's clear enough 🙂
Any help is appreciated.
Thanks!
Matej
Solved! Go to Solution.
Let me know if this works? *** Calculations like this are DEPENDENT on your data being Properly SORTED First! **
P.S. Do we need to take into account First / Last week of the year? (if Week 1 -1 woudl be 0, look for 52 instead?)
Proud to give back to the community!
Thank You!
@MatejZukovic , measure approch is this week vs last week, you can week rank of week but need to separate table
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
Column way =
new user =if(isblank(countx(filter(table,[user]=earlier([user]) && [week] =earlier([week]) -1),[user])),"Yes","No")
Sorry, ignore the 'Sory' comment, I was thinking of a differnt situation...
Obvioustly there's multiple way to solve this based on all the posts. Here's one way to take YEARS and Weeks into consideration.
Proud to give back to the community!
Thank You!
@MatejZukovic , measure approch is this week vs last week, you can week rank of week but need to separate table
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
Column way =
new user =if(isblank(countx(filter(table,[user]=earlier([user]) && [week] =earlier([week]) -1),[user])),"Yes","No")
Try this measure:
New User =
VAR _prweek =
SELECTEDVALUE ( Users[Week] ) - 1
VAR _user =
SELECTEDVALUE ( Users[User] )
VAR _Cnt =
CALCULATE (
COUNTROWS ( Users ),
FILTER ( ALL ( Users ), Users[Week] = _prweek && Users[User] = _user )
)
RETURN
SWITCH ( TRUE (), _Cnt > 0, "No", "Yes" )
_______________
If I helped, please accept the solution and give kudos! 😀
Let me know if this works? *** Calculations like this are DEPENDENT on your data being Properly SORTED First! **
P.S. Do we need to take into account First / Last week of the year? (if Week 1 -1 woudl be 0, look for 52 instead?)
Proud to give back to the community!
Thank You!
Hi @fhill , your solution works perfectly. Great point on first / last week of the year. How would you approach it? Also, can you elaborate bit more on data must be sorted properly?
Thanks a ton,
Matej
Sorry, ignore the 'Sory' comment, I was thinking of a differnt situation...
Obvioustly there's multiple way to solve this based on all the posts. Here's one way to take YEARS and Weeks into consideration.
Proud to give back to the community!
Thank You!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
90 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |