Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
So, my problem is:
I have a bunch of equal IDs, and I want to check when a value is changed in another column. When changed, I need to return how much time the value was the same before changing and say what it was and what it became:
Each ID appears for the same amount, and each one have a status column, here's an example with one of the IDs:
id | status | date_check |
1135381099869705 | x | a |
1135381099869705 | x | b |
1135381099869705 | x | c |
1135381099869705 | x | d |
1135381099869705 | y | e |
1135381099869705 | y | f |
1135381099869705 | y | g |
1135381099869705 | z | h |
1135381099869705 | z | i |
1135381099869705 | z | j |
1135381099869705 | z | k |
1135381099869705 | z | l |
1135381099869705 | z | m |
Basically, I need to check when X became Y, then return the difference of dates e and a (I already have these dates). The same for when Y becomes Z.
Solved! Go to Solution.
NewColumn = VAR CurrentStatus_ = Table1[status] VAR FollowingDate_ = CALCULATE ( MIN ( Table1[date_check] ); Table1[date_check] > EARLIER ( Table1[date_check] ); ALLEXCEPT ( Table1; Table1[id] ) ) VAR FollowingStatus_ = CALCULATE ( VALUES ( Table1[status] ); Table1[date_check] = FollowingDate_; ALLEXCEPT ( Table1; Table1[id] ) ) VAR Status_Transition_ = CurrentStatus_ <> FollowingStatus_ RETURN IF ( Status_Transition_; VAR FollowingStatus_StartDate_ = CALCULATE ( MIN ( Table1[date_check] ); Table1[status] = FollowingStatus_; ALLEXCEPT ( Table1; Table1[id] ) ) VAR CurrentStatus_StartDate_ = CALCULATE ( MIN ( Table1[date_check] ); ALLEXCEPT ( Table1; Table1[id]; Table1[status] ) ) RETURN IF ( NOT ISBLANK ( FollowingStatus_StartDate_ ); FollowingStatus_StartDate_ - CurrentStatus_StartDate_ ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |