Forum Discussion
Combining Columns or replacing
- 5 years ago
I'd really call that doing it from the Ribbon scott_Abaana - you want several if/then/else constructs. If you can do nested IF() functions in Excel (or IFS()) then you can do this.
From the ribbon, go to Add Columns, then Custom Column, and type in this formula:
if [FREQ] = "Cash" then [Amount] else if [FREQ] = "Yearly" then [Amount] else if [FREQ] = "Monthly" then [Amount] * 12 else if [FREQ] = "Quarterly" then [Amount] * 4 else nullSo intead of creating all of the columns, you just do the math on the [Amount] field.
The if/then/else construct is a bit different than Excel.
- the keywords if, then, and else are always lowercase
- All three are required. Excel lets you leave the last one out and you can do =IF(A1=5,3) and that will return a blank if A1 doesn't equal 5 in Excel. In Power Query, if [Field] = 5 then 3 will return an error because else is missing. I used else null for your final answer, but you can return the 9999999 if you want.
Here is your workbook back. Look at my Single if then else query.
I am not 100% sure I understand what you are asking scott_Abaana but see if this helps. In Power Query, all steps are tracked through the Applied Steps pane.
You can go back up to previous steps and redo/modify them. As long as you are careful, all changes will just work. If you break something, like rename a column in the 3rd step that the 5th step needs, you just go to the 5th step and tell it to reference the new column name in the Power Query formula bar.
If this is not what you are asking, can you provide some screenshots and/or data of the issue with a bit more information?
How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum