Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Celliott04
Frequent Visitor

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. Total Column.png

1 ACCEPTED SOLUTION

Hi @Celliott04 ,

 

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.

1.png

You can download my sample for more details.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
parry2k
Super User
Super User

@Celliott04 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 YouTube.gif 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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.

Syntax Error.png

 

 

 

Hi @Celliott04 ,

 

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.

1.png

You can download my sample for more details.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Celliott04
Frequent Visitor

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_line
 
Is this all you need @parry2k ? 
parry2k
Super User
Super User

@Celliott04 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/38490

 

Follow us on LinkedIn and YouTube.gif 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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.