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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,996
Messages
6,175,853
Members
452,675
Latest member
duongtruc1610

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