Forum Discussion
Multiplying values
- 5 years ago
Hi abukapsoun
There are 2 ways to do this.
- You can unpivot the columns, then create the new column with the IF function in DAX
- Or, you can create the IF function in Power Query Editor before unpivoting: Power Query > Add Column > Custom Column > Formula: if [Reference] = "X" then [P01]*-1 else [P01]
**Update: formula amended as needed
Thank you very much, will give it a try.
Will I be able to unpivot the columns P01- New and P02 New ?
If this is a query, you can always unpivot it in Power Query mode.
Power Query > Transform > Unpivot Columns
- abukapsoun5 years agoPost Patron
Hi
I have created the new columns and it is working like a charm. However when I go to query editor to unpivot the columns, the newly created column does not appear in the table. I assume because they were created from a formula ? But then how can I unpivot them ?
I want to have them in the form of:
Thanks,
- darentengmfs5 years agoPost Prodigy
Hi abukapsoun
There are 2 ways to do this.
- You can unpivot the columns, then create the new column with the IF function in DAX
- Or, you can create the IF function in Power Query Editor before unpivoting: Power Query > Add Column > Custom Column > Formula: if [Reference] = "X" then [P01]*-1 else [P01]
**Update: formula amended as needed
- abukapsoun5 years agoPost Patron
I guess we are almost there,
I tried creating the formula:
IF [Reference] = "X" then [P01]*(-1) else [P01]
But I am getting the following error on P01: Token Eof expected.
Any idea?