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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
MagnusPetersson
New Member

Keep above value if difference below threshold

I want Power Query to generate the output column based on the input column and a threshold constant (=0.9 in below example). The first output value is the first input value and then output value is either the above output value, if input is a higher value than the above output value multiplied with the threshold constant (0.9), or the corresponding input value. 

InputOutput
2.002.00
1.982.00
1.962.00
1.942.00
1.922.00
1.902.00
1.882.00
1.862.00
1.852.00
1.832.00
1.812.00
1.791.79
1.771.79
1.761.79
1.741.79
1.721.79
1.701.79
1.691.79
1.671.79
1.651.79
1.641.79
1.621.79
1.601.60
1.591.60
1 ACCEPTED SOLUTION
wdx223_Daniel
Community Champion
Community Champion

= #table({"Input","Output"},List.Accumulate(PreviousStepName[Input],{},(x,y)=>if x={} then {{{y,y}},y} else if y<=x{1}*0.9 then {x{0}&{{y,y}},y} else {x{0}&{{y,x{1}}},x{1}}){0})

View solution in original post

1 REPLY 1
wdx223_Daniel
Community Champion
Community Champion

= #table({"Input","Output"},List.Accumulate(PreviousStepName[Input],{},(x,y)=>if x={} then {{{y,y}},y} else if y<=x{1}*0.9 then {x{0}&{{y,y}},y} else {x{0}&{{y,x{1}}},x{1}}){0})

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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