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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
Super User
Super User

= #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
Super User
Super User

= #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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors