Forum Discussion
Measure IF String Equals One Value THEN SUM ELSE SUM2
Hey everyone,
I am not that experienced in PowerBI since I have mostly done calculations like that on Tableau before.
So what I need to do is in principle a basic IF ELSE calculation.
Some stores record their customers in two groups RR and SR so, some stores on the other hand just combine these two so what I am trying to do is do an IF calculation so that I get the correct values.
In Tableau this calculation would look somewhat like this:
IF Store = "CombineStore" THEN SUM (RR+SR) ELSE SUM(SR) END
However, in PowerQuery it seems that IF statements can only be done with measures.
I hope someone can help
Hi Manolsmn
You can use the below to achieve what you want. Just click "New Column" in the ribbon and then you can apply the following:
Calculated Column = IF ( 'Table'[Column] = "CombineStore" , 'Table'[SR] + 'Table'[SR] , 'Table'[SR] )
Note that the above is based on your requirement to combine two values which I assume are in two separate columns.
Hope this helps.
Theo
1 Reply
- TheoC
Community Champion
Hi Manolsmn
You can use the below to achieve what you want. Just click "New Column" in the ribbon and then you can apply the following:
Calculated Column = IF ( 'Table'[Column] = "CombineStore" , 'Table'[SR] + 'Table'[SR] , 'Table'[SR] )
Note that the above is based on your requirement to combine two values which I assume are in two separate columns.
Hope this helps.
Theo