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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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])

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])

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

 

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.