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
PowerBI_Explore
New Member

Get previous value of a table and show as card

Hi there

I've got a table with 3 columns "Company", "Month" and "Rating":

PowerBI_Explore_0-1646084477558.png

Now I'd like to get a new column (or measure) to get the "Rating" of the previous available month.
If there isn't a value for an earlier month respectively it's the first entry (like Company A / Month 1), the value 0 should be displayed.

 

My final goal is to have two slicers, one for "Company" and one for "Month" and two card visuals with the information about the "current" rating and the previous rating:

PowerBI_Explore_1-1646084494337.png

How can I solve this by using DAX?

Thank you in advance for your help!

 

Best regards,

Tom

1 ACCEPTED SOLUTION
jaipal
Resolver III
Resolver III

@PowerBI_Explore Create a Index Column starts with 1

and create column with this DAX:

Previous Rating =
CALCULATE(MAX('Table'[Rating]),FILTER('Table','Table'[Index]=EARLIER('Table'[Index])-1))
 
Here is your expected result:
 
jaipal_0-1646098714775.png

 

 

View solution in original post

2 REPLIES 2
jaipal
Resolver III
Resolver III

@PowerBI_Explore Create a Index Column starts with 1

and create column with this DAX:

Previous Rating =
CALCULATE(MAX('Table'[Rating]),FILTER('Table','Table'[Index]=EARLIER('Table'[Index])-1))
 
Here is your expected result:
 
jaipal_0-1646098714775.png

 

 

Works perfectly like expected, appreciate your help - thank you very much!

 

Only need to figure out, how I should handle the first entry / record of every company correctly, so that it will display no value instead of the last value of the previous company. I think I should be able to solve this with the same logic and an additional check, if the company is the same then the one with index-1.

 

Best regards

Dominique

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