Forum Discussion
Incorrect Totals for Measured Column
I am currently creating a report that shows a cost of goods, rebated cost of goods, and true cost of goods column. The picture posted below shows the measure I created for the true cost of goods. However, the totals for the column are way off. Is there an issue with the measure I created that would be causing this problem? The totals at the bottom should be closer to the $400,000 mark and not the $152 million it is currently showing.
- Anonymous4 years ago
Hi Anonymous ,
I think [other_cost x qty_shipped] should be a measure, due to you can use it directly in your IF code.
I update your code, please try this.
True Cost 1= SUMX ( SUMMARIZE ( p21_view_invoice_line, p21_view_invoice_line[cogs_amount], "other_cost x qty_shipped", [other_cost x qty_shipped], "@Cost", IF ( p21_view_invoice_line[other_cost x qty_shipped] = 0, SELECTEDVALUE ( p21_view_invoice_line[cogs_amount] ), p21_view_invoice_line[other_cost x qty_shipped] ) ), [@Cost] )In my sample it works. Result is as below.
You can download my sample for more details.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 Replies
- parry2kSuper User
Anonymous you need to share the DAX measure expression you are using, and how the tables are connected.
Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490Follow us on LinkedIn and to our YouTube channel
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
- AnonymousNot applicable
Here is the measure that I am using for the column.
True Cost =
IF (
p21_view_invoice_line[other_cost x qty_shipped] = 0,
SELECTEDVALUE ( p21_view_invoice_line[cogs_amount] ),
p21_view_invoice_line[other_cost x qty_shipped]
)Both of these fields are from the same table p21_view_invoice_lineIs this all you need parry2k ? - parry2kSuper User
Anonymous whatever columns you have on the rows, put that in the summarize:
rue Cost = SUMX ( SUMMARIZE ( Table, Table[Column1 On Row], Table[Column 2 Row], "@Cost", IF ( p21_view_invoice_line[other_cost x qty_shipped] = 0, SELECTEDVALUE ( p21_view_invoice_line[cogs_amount] ), p21_view_invoice_line[other_cost x qty_shipped] ), [@cost] )Follow us on LinkedIn and to our YouTube channel
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
- AnonymousNot applicable
I attempted to use that DAX expression below and I was getting the error, "Too few arguments were passed to the SUMX function. The minimum argument count for the function is 2."
True Cost = SUMX (SUMMARIZE ( p21_view_invoice_line, p21_view_invoice_line[cogs_amount], p21_view_invoice_line[other_cost x qty_shipped],"@Cost", IF (p21_view_invoice_line[other_cost x qty_shipped] = 0,SELECTEDVALUE ( p21_view_invoice_line[cogs_amount] ),p21_view_invoice_line[other_cost x qty_shipped]),[@Cost]))I also put that expression into DAX formatter and was getting a syntax error. I have included that as well.
- AnonymousNot applicable
Hi Anonymous ,
I think [other_cost x qty_shipped] should be a measure, due to you can use it directly in your IF code.
I update your code, please try this.
True Cost 1= SUMX ( SUMMARIZE ( p21_view_invoice_line, p21_view_invoice_line[cogs_amount], "other_cost x qty_shipped", [other_cost x qty_shipped], "@Cost", IF ( p21_view_invoice_line[other_cost x qty_shipped] = 0, SELECTEDVALUE ( p21_view_invoice_line[cogs_amount] ), p21_view_invoice_line[other_cost x qty_shipped] ) ), [@Cost] )In my sample it works. Result is as below.
You can download my sample for more details.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Ashish_MathurSuper User
Hi,
Share the link from where i can download your PBI file.