Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hi All, can you help me with this "If" DAX?
I couldn't solve the problem.
In a generated Excel table, In column N, I have Cost which should be a multiplication of "Net Quantity" and "Product/item Cost". However, In the green highlighted cells the cost is missing. So, I need a DAX to solve this.
Currently, I created a column in the Excel file - Column "O" (you can see the Excel formula in the above screenshot). But I want to add a DAX for the same formula I put in column "O" which is like the below:
Cost = If "Net Quantity" * "Product/item Cost" = 0, then "Net sales" * 56% or else "Net Quantity" * "Product/item Cost".
Here I use 56% as an average cost % against sales for all other products. (if any Dax can be created for this please help me on that too If possible)
I need the DAX to calculate the Cost for each row individually.
Solved! Go to Solution.
Hi @FR_PBI ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a calculated column.
Cost = IF([Net Quantity]*[Product/item Cost]=0,[Net Sales]*0.56,[Net Quantity]*[Product/item Cost])
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous Thank you! I have added a column with this formula.
As you can see, in the orange highlighted column (earlier cost column with blank/zero values ) now has the value in the yellow highlighted column. Now I have a new added column in the table.
However, I have a question, if I don't want to add a column in the table and only want to create a measure with a DAX what can I do?
Best Regards,
Hi @FR_PBI ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a calculated column.
Cost = IF([Net Quantity]*[Product/item Cost]=0,[Net Sales]*0.56,[Net Quantity]*[Product/item Cost])
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.