Forum Discussion
Previous function employee
- 2 years ago
ok i got you
you needed to be partitioned by pperson_bk
step0 :
you need to fix the column functionchangedate to respect the following format :
m-dd-yyyy
step1 : go to power query and change the column functionchangeddate type from text to date
step 3 : in power query sort asc the first column :
step 4 :
sort functionchangeddate column asc
save and apply.
step 5 :
use this measure now :Column =var current_perosn = 'Table (7)'[Person_BK]var current_date = 'Table (7)'[FunctionChangedDate]var datasource =FILTER(all('Table (7)'[FunctionChangedDate],'Table (7)'[FunctionName],'Table (7)'[Person_BK]),'Table (7)'[Person_BK] = current_perosn && 'Table (7)'[FunctionChangedDate] <=current_date&& 'Table (7)'[FunctionChangedDate] <=current_date)returnSELECTCOLUMNS(offset(-1,datasource,ORDERBY('Table (7)'[FunctionChangedDate] , asc ),PARTITIONBY('Table (7)'[Person_BK])),[FunctionName])
yes,
you need to sort the order of the table asc by functionchangedDate column ,
since the offset function is base on the order of this column .
click on the arrow of the column and sort it ascending,
if you have any questions please post it and i will try to help you .
Thanks. Any idea how I directly can get this result:
| Person_BK | FunctionChangedDate | FunctionName | @PreviousFunctionName |
| 555 | 1-12-2020 | function A | |
| 555 | 1-3-2022 | function B | function A |
| 555 | 1-8-2022 | function C | function B |
| 555 | 17-8-2023 | function D | function C |
| 1111 | 1-1-2014 | Medewerker Servicecenter 2 | |
| 1111 | 1-1-2022 | Ondernemersadviseur 1 | Medewerker Servicecenter 2 |
| 1111 | 1-3-2023 | Ondernemersadviseur 1 | Ondernemersadviseur 1 |
| 1111 | 16-10-2023 | Adviseur Business Support 1 | Ondernemersadviseur 1 |
| 1111 | 1-1-2024 | Adviseur Business Support 2 | Adviseur Business Support 1 |
| 2222 | 1-1-2014 | Procesmanager 2 | |
| 2222 | 1-1-2021 | Teamleider IT Operations | Procesmanager 2 |
| 2222 | 1-3-2022 | Practice Lead Infra | Teamleider IT Operations |
| 2222 | 1-10-2022 | Product Owner | Practice Lead Infra |
| 2222 | 15-3-2023 | Product Owner 1 | Product Owner |
| 2222 | 1-7-2023 | Product Owner 2 | Product Owner 1 |
Thanks for your help.
Kind regards, Elmer
- Daniel291952 years agoCommunity Champion
ok i got you
you needed to be partitioned by pperson_bk
step0 :
you need to fix the column functionchangedate to respect the following format :
m-dd-yyyy
step1 : go to power query and change the column functionchangeddate type from text to date
step 3 : in power query sort asc the first column :
step 4 :
sort functionchangeddate column asc
save and apply.
step 5 :
use this measure now :Column =var current_perosn = 'Table (7)'[Person_BK]var current_date = 'Table (7)'[FunctionChangedDate]var datasource =FILTER(all('Table (7)'[FunctionChangedDate],'Table (7)'[FunctionName],'Table (7)'[Person_BK]),'Table (7)'[Person_BK] = current_perosn && 'Table (7)'[FunctionChangedDate] <=current_date&& 'Table (7)'[FunctionChangedDate] <=current_date)returnSELECTCOLUMNS(offset(-1,datasource,ORDERBY('Table (7)'[FunctionChangedDate] , asc ),PARTITIONBY('Table (7)'[Person_BK])),[FunctionName]) - powerbifuddaa2 years agoHelper II
Thanks Daniel29195
Although I get an error again (Parameter is not the correct type), this works!
If I remove the "PARTITIONBY('Table (2)'[Person_BK])" part, it also works.
Thank you for your help
- Daniel291952 years agoCommunity Champion
powerbifuddaa
glad i could help you out .Feel free to mention my name in your future questions within the community. I would be more than happy to assist you further.