Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am trying to create a calculated column "NextValidWW" which gets the next greater workweek partitioned by the ProjectID and TaskID. See below:
In SQL, I was able to achieve this by:
LEAD(StatusWW) OVER (
PARTITION BY TaskUID,
ProjectID
ORDER BY StatusWW
)
I found a post on reddit where it gives a very similar solution, but I am not getting my desired outcome:
TRY 1:
This works when the "next" greater work week is only greater than the StatusWW by 1 - but does not account for cases when the "next" greater work week could be greater than 1.
=CALCULATE(
VALUES(DCN_NextWW[StatusWW]),
ALLEXCEPT(DCN_NextWW, DCN_NextWW[ProjectID], DCN_NextWW[TaskUID]),
DCN_NextWW[StatusWW] = EARLIER(DCN_NextWW[StatusWW]) + 1 )
TRY 2:
This just gives me ERROR - which I understand it's returning all values that are greater than StatusWW - not just the "next" greater value
=CALCULATE(
VALUES(DCN_NextWW[StatusWW]),
ALLEXCEPT(DCN_NextWW, DCN_NextWW[ProjectID], DCN_NextWW[TaskUID]),
DCN_NextWW[StatusWW] > EARLIER(DCN_NextWW[StatusWW]))
It seems like TRY 2 could use more conditions where [StatusWW] < the next [StatusWW] but I am not sure how to do that in DAX.. there is no NEXT() function that I am aware of
Solved! Go to Solution.
Found a solution on another community post
CALCULATE(
MIN(DCN_NextWW[StatusWW]),
FILTER(
DCN_NextWW,
DCN_NextWW[StatusWW] > EARLIER(DCN_NextWW[StatusWW]) && (DCN_NextWW[ProjectID] = EARLIER(DCN_NextWW[ProjectID]) && DCN_NextWW[TaskUID] = EARLIER(DCN_NextWW[TaskUID]))))
Found a solution on another community post
CALCULATE(
MIN(DCN_NextWW[StatusWW]),
FILTER(
DCN_NextWW,
DCN_NextWW[StatusWW] > EARLIER(DCN_NextWW[StatusWW]) && (DCN_NextWW[ProjectID] = EARLIER(DCN_NextWW[ProjectID]) && DCN_NextWW[TaskUID] = EARLIER(DCN_NextWW[TaskUID]))))
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
24 | |
9 | |
7 | |
6 | |
6 |
User | Count |
---|---|
29 | |
11 | |
11 | |
10 | |
6 |