Conditional Column

Brock_Hardchest

New Member
Joined
Feb 23, 2018
Messages
27
Hello,

New to power query, I need to change a column based off of another column. The logic is that if Data Tier List.Column1 is not null (in the first case it is 51985) then the quantity of 1 should be changed to 55.9140625 (same as the other quantity for the other 51985). Since the next item is 2596 then it's quantity of 1 should become 142.7138672. The next item is null and should remain unchanged.

Does anyone know if it is possible to do this? Would I have to write it out manually in M?

1666299849831.png
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Do these always come in pairs, or can there be more than two subsequent rows with the same value in Data Tier List.Column1?
 
Upvote 0
In that case, you can create two index columns, and have one start with 0 and the other with 1. Then do a merge with itself, but using the two different indexes.

1666377580987.png


Then when you expand the quantity from the table, it will have been offset one row down.

1666377739892.png


Then you can do a conditional column:

1666377827498.png
 

Attachments

  • 1666377542199.png
    1666377542199.png
    12.5 KB · Views: 6
Upvote 0
Solution

Forum statistics

Threads
1,223,603
Messages
6,173,302
Members
452,509
Latest member
CSHOCK

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top