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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.