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])
what is weird is that from my side i didnt get any error .
could you pllease try one of the following :
1. add the table name before the column name , so instead of [FunctionName] , write : Table_Name[FunctionName] ( with table_name = the table name you have in your model )
if this doesnt work,
try this :
Hi Daniel29195 ,
I don't get an error anymore after adding the text in bold:
This looks good.
After testing and adding more person_bk's I get an output that I didn't expect:
| Person_BK | FunctionChangedDate | FunctionName | @PreviousFunctionName |
| 555 | 1-12-2020 | function A | Procesmanager 2 |
| 555 | 1-3-2022 | function B | Ondernemersadviseur 1 |
| 555 | 1-8-2022 | function C | Practice Lead Infra |
| 555 | 17-8-2023 | function D | Product Owner 2 |
| 1111 | 16-10-2023 | Adviseur Business Support 1 | function D |
| 1111 | 1-1-2024 | Adviseur Business Support 2 | Adviseur Business Support 1 |
| 1111 | 1-1-2014 | Medewerker Servicecenter 2 | |
| 1111 | 1-1-2022 | Ondernemersadviseur 1 | Teamleider IT Operations |
| 1111 | 1-3-2023 | Ondernemersadviseur 1 | Product Owner |
| 2222 | 1-3-2022 | Practice Lead Infra | function B |
| 2222 | 1-1-2014 | Procesmanager 2 | Medewerker Servicecenter 2 |
| 2222 | 1-10-2022 | Product Owner | function C |
| 2222 | 15-3-2023 | Product Owner 1 | Ondernemersadviseur 1 |
| 2222 | 1-7-2023 | Product Owner 2 | Product Owner 1 |
| 2222 | 1-1-2021 | Teamleider IT Operations | function A |
Any idea? Thank you for your help.
Kind regards, Elmer
- Daniel291952 years agoCommunity Champion
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 .
- powerbifuddaa2 years agoHelper II
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])