Forum Discussion
If Row Item Changes Based on Time Then Flag
I am trying to create a report item that shows when an item is changed in a row based on the time or timestamp. I need to create a custom column that shows a flag when the item has changed. In the image below you can see what the outcome should be. The date is the same day and it should only see the change by time and status #.
Hi cchp07 ,
Insert an index column in power query as below.
Then we can create a calculated column to get the excepted reuslt.
Column = VAR i_1 = 'Table'[Index] - 1 VAR i1 = 'Table'[Index] + 1 VAR st_1 = CALCULATE ( MAX ( 'Table'[Status #] ), FILTER ( 'Table' , 'Table'[Index] = i_1 ) ) VAR st1 = CALCULATE ( MAX ( 'Table'[Status #] ), FILTER ( 'Table' , 'Table'[Index] = i1 ) ) RETURN IF ( st_1 <> 'Table'[Status #] && st1 = 'Table'[Status #], "out", IF ( st_1 <> 'Table'[Status #] && 'Table'[Status #] <> st1 && i_1 > 0, "in", BLANK () ) )For more details, please check the pbix as attached.
3 Replies
- amitchandak
Super User
Try EARLIER
https://community.powerbi.com/t5/Desktop/Explanation-of-the-EARLIER-formula/td-p/529469
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601 - v-frfei-msft
Community Support
Hi cchp07 ,
Insert an index column in power query as below.
Then we can create a calculated column to get the excepted reuslt.
Column = VAR i_1 = 'Table'[Index] - 1 VAR i1 = 'Table'[Index] + 1 VAR st_1 = CALCULATE ( MAX ( 'Table'[Status #] ), FILTER ( 'Table' , 'Table'[Index] = i_1 ) ) VAR st1 = CALCULATE ( MAX ( 'Table'[Status #] ), FILTER ( 'Table' , 'Table'[Index] = i1 ) ) RETURN IF ( st_1 <> 'Table'[Status #] && st1 = 'Table'[Status #], "out", IF ( st_1 <> 'Table'[Status #] && 'Table'[Status #] <> st1 && i_1 > 0, "in", BLANK () ) )For more details, please check the pbix as attached.
- cchp07Frequent Visitor
v-frfei-msft This works perfect, but what if there were multiple item #'s?