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.
Hi Everyone,
I'm trying to use SAMEPERIODLASTYEAR to lookup a text string from last year but looks like this only works for numeric calculations. Here is a sample from my data model table (I want a DAX formula for the fourth column to return the values shown):
Company | Year | Code | Company's Code Last Year |
Company A | 2001 | R-22 | |
Company B | 2001 | F-03 | |
Company C | 2001 | G-12 | |
Company A | 2002 | R-22 | R-22 |
Company B | 2002 | F-03 | F-03 |
Company C | 2002 | G-16 | G-12 |
Company A | 2003 | M-22 | R-22 |
Company B | 2003 | F-03 | F-03 |
Company C | 2003 | G-16 | G-16 |
I want the fourth column to be a calculated column that answers the question (If this year is 2003, what was the company's code last year (2002)? I tried so many things but still can't figure out a formula to do it.
I would really appreciate the help.
Solved! Go to Solution.
@IABKOmarISB , Try a new column like
maxx(filter(Table, [Company] = earlier([Company]) && [year] = earlier([year]) -1 ), [Code])
@IABKOmarISB , Try a new column like
maxx(filter(Table, [Company] = earlier([Company]) && [year] = earlier([year]) -1 ), [Code])
Do you mind if I share your solution on the other forum that I posted the question on and credit you?
It works! Thanks a million!
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 |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
51 | |
46 | |
39 | |
19 | |
19 |