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 "Quantit...
- 4 years ago
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 )
Samarth_18
4 years agoCommunity Champion
Syndicate_Admin , You could try this:-
Quantity2 = if('Table'[category] = "Premium",'Table'[Quantity]*2,'Table'[Quantity]*1)Syndicate_Admin
4 years agoAdministrator
it does not allow me to select the table, it only allows me to select measurements.
- Samarth_184 years agoCommunity Champion
Syndicate_Admin Whats the error your getting. Could you please share the code which you trying?
- Syndicate_Admin4 years agoAdministrator
My Table is called "SaleProducts", the column is "Product Category", when I try to write the function the table is not displayed:
- Samarth_184 years agoCommunity Champion
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 )