Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
i have three columns - status, user and month. the status is the same for every month for each user but it is only correct for the last month, all earlier entries should be "Active".
I had a solution in power query using a function that works on my home latest release power BI version, howerver my work power BI desktop is an older version due to IT policy and i get a function error.
is there a way in DAX to produce the column i need?
how it is:
Status | User | Month |
Complete | User1 | 1/01/2021 |
Complete | User1 | 1/02/2021 |
Complete | User1 | 1/03/2021 |
Withdrawn | User2 | 1/01/2021 |
Withdrawn | User2 | 1/02/2021 |
Withdrawn | User2 | 1/03/2021 |
Active | User3 | 1/01/2021 |
Active | User3 | 1/02/2021 |
Active | User3 | 1/03/2021 |
how it should be:
Status | User | Month |
Active | user1 | 1/01/2021 |
Active | User1 | 1/02/2021 |
Complete | user1 | 1/03/2021 |
Active | User2 | 1/01/2021 |
Active | User2 | 1/02/2021 |
Withdrawn | User2 | 1/03/2021 |
Active | User3 | 1/01/2021 |
Active | User3 | 1/02/2021 |
Active | User3 | 1/03/2021 |
Solved! Go to Solution.
@Anonymous ,
You can try this measure:
Measure =
VAR currentUser = MAX ( T[User] )
VAR latestDate = MAXX ( FILTER ( ALL ( T ), T[User] = currentUser ), T[Month] )
VAR latestStatus =
CALCULATE (
MAX ( T[Status] ),
T[User] = currentUser,
T[Month] = latestDate
)
RETURN
IF ( MAX ( T[Month] ) = latestDate, latestStatus, "Active" )
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Can you please share the sample data file?
The data you provided seems to be incomplete as User2 has different status for same day.
Regards,
Sanket Bhagwat
appoligies - i have changed the data in the post. should have been 3 users.
@Anonymous ,
you have 2 different values for the last month for User 2..
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
i've updated the post - it hsould have been 3 users.
@Anonymous ,
You can try this measure:
Measure =
VAR currentUser = MAX ( T[User] )
VAR latestDate = MAXX ( FILTER ( ALL ( T ), T[User] = currentUser ), T[Month] )
VAR latestStatus =
CALCULATE (
MAX ( T[Status] ),
T[User] = currentUser,
T[Month] = latestDate
)
RETURN
IF ( MAX ( T[Month] ) = latestDate, latestStatus, "Active" )
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Hi ERD, thanks for the reply - i'm not sure if i am doing something wrong but when i'm doing it i get "Active" for all results
@Anonymous , the code is for the measure, your image shows a calculated column. You need a calculated column ? If so, here the code:
New status =
VAR currentUser = T[User]
VAR latestDate =
MAXX ( FILTER ( ALL ( T[User], T[Month] ), T[User] = currentUser ), T[Month] )
VAR latestStatus =
CALCULATE (
MAX ( T[Status] ),
T[User] = currentUser,
T[Month] = latestDate
)
RETURN
IF ( T[Month] = latestDate, latestStatus, "Active" )
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
ERD thankyou for this - i was also able to get the first response to work once i corrected my mistake so i'll accept that as the solution as it answers the original question.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |