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! Request now

Reply
Syndicate_Admin
Administrator
Administrator

Copy the last non-zero value to another column and make it the same value for all rows

I have a column with the week number and another with the number of sales per week:
Week W7 is the current week and weeks W8 and W9 are the next weeks.

week | Sales

------------------
W1 | 12

W2 | 11

W3 | 19

W4 | 1

W5 | 2

W6 | 112
W7 | 16

W8 | 0

W9 |

And I wanted to have a measure that would return me.

week | New Column

----------------------------
W1 | 16

W2 | 16

W3 | 16

W4 | 16

W5 | 16

W6 | 16
W7 | 16

W8 | 16

W9 | 16

or this would also be worth it:

week | New Column

----------------------------
W7 | 16

W8 | 16

W9 | 16

Thanks a lot

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Syndicate_Admin ,


new column =
var _max = maxX(filter(Table, [Sales] >0 && not(isblank([Sales]))),[Week])
return
sumx(filter(Table, [Week] =_max),[Sales])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Syndicate_Admin ,


new column =
var _max = maxX(filter(Table, [Sales] >0 && not(isblank([Sales]))),[Week])
return
sumx(filter(Table, [Week] =_max),[Sales])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for your reply.
I have tried it and it returns the following:

week | New column

-----------------------------
W1 | 12

W2 | 11

W3 | 19

W4 | 1

W5 | 2

W6 | 112
W7 | 16
W8 |

W9 |

@Syndicate_Admin , check this file

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

jumans92_0-1645179410097.png

I don't understand why it doesn't come out makes me a total.
my Sales Column is a calculated column, I don't know if it can be affected by that.

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