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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Mat87
Frequent Visitor

Get the most recent value as it is

So I have a table like that looks like this:

 

aa2.png

 

What I want is to create a measure that get me the most recent value for each ID. So when I view the data in a pivottable it give me:

 

AA 12

BB 20

CC 15

DD 22

 

Any idea how I can get this done in DAX/powerpivot? 

3 REPLIES 3
v-jiascu-msft
Microsoft Employee
Microsoft Employee

@Mat87

 

Hi,

 

Could you tell me please if your problem is solved? You can mark the right answer to help others if it's convenient for you.

 

Best Regards!
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Microsoft Employee
Microsoft Employee

@Mat87

 

Hi,

 

Following @Greg_Deckler's idea, you need to do these steps.

  1. Choose columns 2007, 2008, 2009, 2010 with “Ctrl” pressed in Query Editor.
  2. Click “Unpivot Columns”.
  3. Change names “Attribute” to “Year”,.
  4. Create a measure:

Measure =

CALCULATE (

    MIN ( Table1[Value] ),

    FILTER ( Table1, Table1[Attribute] = MAX ( Table1[Attribute] ) )

)

 

If you only have columns 2007, 2008, 2009, 2010, you still can try a calculated column.

LatestValue =

IF (

    ISBLANK ( [2010] ),

    IF (

        ISBLANK ( [2009] ),

        IF ( ISBLANK ( [2008] ), IF ( ISBLANK ( [2007] ), BLANK (), [2007] ), [2008] ),

        [2009]

    ),

    [2010]

)

 

Get the most recent value as it is .jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
Community Champion

You are going to want to unpivot your data on import so that you get your table in a format like:

 

ID, Year, Value

 

You'll do this in the Query Editor. At that point, your problem is fairly trivial.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors