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

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

Reply
stiguuuu
Frequent Visitor

How to divide values ​​in a table by the last row

Hello,

I have a table with Data and total Sales in each month (name of monhts in polish language).

I want to add a column (by measure) in my table includes:

for each month, divide the value of the last month in the table (in this case it is March) and the value for the selected month.

 

for example:

- in January 2023, the sales value from March 2024 (last month) divided by the sales value from January 2023

- in February 2023, the sales value from March 2024 (last month) divided by the sales value from February 2023

 

Thanks for all tips how I can do that measure.

 

Regards,

TomaszProblem_BI.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Have you tried declaring a variable of LastMonth = MONTH(TODAY() -1) or DATEADD?  The functions should not be affected by the row context. Then you can use the MAX at the row level for dividing by the declared variable

View solution in original post

5 REPLIES 5
stiguuuu
Frequent Visitor

Thank you for your answer.

I tried what you wrote about and actually when I want to display the result in the MAX date value tab, it shows the value from the last month and it is ok.

The problem occurs when such a measure is inserted into the table as a column. MAX date is read as a value from a particular month, not the last one in the entire table. Each month itself is MAX (not the last one in the table)

Anonymous
Not applicable

Have you tried declaring a variable of LastMonth = MONTH(TODAY() -1) or DATEADD?  The functions should not be affected by the row context. Then you can use the MAX at the row level for dividing by the declared variable

I did it on my own and works but thank you for your tips guys. Below detailsgot it.JPG

read about ALLSELECTED

lbendlin
Super User
Super User

- find the MAX date in your current filter context

- find the value for that date (for example via CALCULATE)

- DIVIDE the result by the value for the "current"  row

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.