Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Filter the latest month for Lookupvalue

Hi,

I have a table with employee ID, their line manager ID, and their positions in many months. I would like to use Lookupvalue to create a new column in this table to get the position of  their line managers. However, position of each employee can change from month to month, and Lookupvalue cannot find the result. How can I create a Dax: when the position is not identical for all months, return the position of the latest month?

Thank you!

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Your original Month column is of Text data type ("January", "February"...) and unable to get the correct latest month value. I would add another YearMonth column (202101, 202102,...) which is of Whole Number data type for comparing. You can also add a month number column if all data is within one calendar year. 

 

Then create below column to get the latest positions. 

Column = 
MAXX (
    FILTER (
        'Table',
        'Table'[YearMonth] = MAX ( 'Table'[YearMonth] )
            && 'Table'[ID] = EARLIER ( 'Table'[Line Manager ID] )
    ),
    'Table'[Position]
)

082401.jpg

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

View solution in original post

9 REPLIES 9
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Your original Month column is of Text data type ("January", "February"...) and unable to get the correct latest month value. I would add another YearMonth column (202101, 202102,...) which is of Whole Number data type for comparing. You can also add a month number column if all data is within one calendar year. 

 

Then create below column to get the latest positions. 

Column = 
MAXX (
    FILTER (
        'Table',
        'Table'[YearMonth] = MAX ( 'Table'[YearMonth] )
            && 'Table'[ID] = EARLIER ( 'Table'[Line Manager ID] )
    ),
    'Table'[Position]
)

082401.jpg

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Anonymous
Not applicable

Thank you very much @v-jingzhang 😊

PaulDBrown
Community Champion
Community Champion

Following @AlB request, please include actual data (not an image) to work with and a depiction of the expected output (you can create a mockup in Excel for example and post the image).





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Hi,

Are you looking for a calculated column formula solution or a measure solution?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Ashish_Mathur , I would like to have a calculated column.

Hi,

I see that your question has already been answered.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
AlB
Super User
Super User

Hi @Anonymous 

Do you want to show some sample data with the expected result?

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Anonymous
Not applicable

Hi AIB,

 

This is sample of data, I have column Month, ID, Name, Line manger ID and Position. I create a new column named Line manger position, and instead of blank for person D, I would like to show HR Manger (his position in March). And next month, when his position changes again, it will show his new position.

trangphan_2-1629632101027.png

Thanks!

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.