Forum Discussion
Syndicate_Admin
4 years agoAdministrator
Help with a conditional
Hello!
In my table I have three categories of product and quantities:
Category Quantity
Premium 50
Basic 30
Extra Costs 20
I need to create a new column "Quantity 2" To be able to multiply Quantity *2 only if it is Premium and if it is Basic or Extra Costs multiply it by 1.
It seems you are trying to create a measure not column. In that case you can use this code:-
Quantity2 = IF ( SELECTEDVALUE ( 'SaleProducts'[Product Category] ) = "Premium", SELECTEDVALUE ( 'SaleProducts'[Quantity] ) * 2, SELECTEDVALUE ( 'SaleProducts'[Quantity] ) * 1 )
7 Replies
- Samarth_18Community Champion
Hi Syndicate_Admin ,
You can create a column as below:-
Quantity2 = if([category] = "Premium",[Quantity]*2,[Quantity]*1)Thanks,
Samarth
- Syndicate_AdminAdministrator
I understand logic, but the category and Quantity columns are from my source table, they are not measured. so typing the dax function does not allow me to select the required columans
- Samarth_18Community Champion
Syndicate_Admin , You could try this:-
Quantity2 = if('Table'[category] = "Premium",'Table'[Quantity]*2,'Table'[Quantity]*1)