Forum Discussion

Annzi's avatar
Annzi
Frequent Visitor
1 year ago
Solved

Calculate Total weight and visualize

I would appreciate some help to get the visualization correct.

I got some help earlier to calculate percentage, I have used that DAX to try to solve this.

What I have

Every day I get the results from the picked orders in a excel spreadsheet.

Since we track every pick, an article can be listed twice in an order.

What I want

To visualize the total weight of all orders for that day, based on the ordered amount.

Issue

I visualize the total ordered weight but it’s wrong.

Its wrong when I have a spreadsheet with no “double article nr” and wrong when I have. So Im not sure if it’s the DAX or the format of visualization.

 

Total should be 7,39 not 22,44. (22,44 = 33*0,68), (7,39=2,00+4,14+1,25)

I have tried to make a column which shows the Total and a measure, both wrong.

In my PBI I use DAX for a measure for ordered amount:

Ordered amount (recalculated) =

var _table=SUMMARIZE('Orders', 'Orders' [Order nr], ''Orders''[Article nr], ''Orders''[Ordered amount])

 RETURN

SUMX(_table,[ Ordered amount])

 

I couldn’t use the weight from the table I get every morning so I added a measure
Netto weight kg  =

var _table=SUMMARIZE('Orders', 'Orders' [Order nr], 'Orders' [Article nr], 'Orders' [Netto weight g])

RETURN

SUMX(_table, 'Orders' [Netto weight g]/1000)

 

Need help to visualize the correct Total.

  • Annzi 

    As far as what I understand you are facing issues with totals, I would suggest you to follow this syntax

    Total Weight =
    var _table= ADDCOLUMNS( SUMMARIZE('Orders', 'Orders' [Order nr], 'Orders' [Article nr], 'Orders' [Netto weight g], 'Orders'[Ordered Amount] ), "Weight", ('Orders' [Netto weight g]/1000) *  'Orders'[Ordered Amount])
    RETURN
    SUMX(_table, [Weight])

    Need a Power BI Consultation? Hire me on Upwork

     

     

     

    Connect on LinkedIn

     

     

     








    Did I answer your question? Mark my post as a solution!
    If I helped you, click on the Thumbs Up to give Kudos.

    Proud to be a Super User!


3 Replies

  • Annzi 

    As far as what I understand you are facing issues with totals, I would suggest you to follow this syntax

    Total Weight =
    var _table= ADDCOLUMNS( SUMMARIZE('Orders', 'Orders' [Order nr], 'Orders' [Article nr], 'Orders' [Netto weight g], 'Orders'[Ordered Amount] ), "Weight", ('Orders' [Netto weight g]/1000) *  'Orders'[Ordered Amount])
    RETURN
    SUMX(_table, [Weight])

    Need a Power BI Consultation? Hire me on Upwork

     

     

     

    Connect on LinkedIn

     

     

     








    Did I answer your question? Mark my post as a solution!
    If I helped you, click on the Thumbs Up to give Kudos.

    Proud to be a Super User!


    • Annzi's avatar
      Annzi
      Frequent Visitor

      Thanks! 👍

      I'll try that one as well. I found a solution myself.