Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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.
Solved! Go to Solution.
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
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @Syndicate_Admin ,
You can create a column as below:-
Quantity2 = if([category] = "Premium",[Quantity]*2,[Quantity]*1)
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
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
@Syndicate_Admin , You could try this:-
Quantity2 = if('Table'[category] = "Premium",'Table'[Quantity]*2,'Table'[Quantity]*1)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
it does not allow me to select the table, it only allows me to select measurements.
@Syndicate_Admin Whats the error your getting. Could you please share the code which you trying?
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
My Table is called "SaleProducts", the column is "Product Category", when I try to write the function the table is not displayed:
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
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |