Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

(DAX) How to sum sales for orders with multiple order lines based on Dimension set ID. Not all order lines in the table has the dimension set id

First question on the platform and a newbie at Powerbi.

I have a table with multiple order lines. I need to calculate the sum for each order that has a specific dimension set ID, ex. "123".

The issue consists of the fact that not all order lines in the table has the dimension set id.
Therefore when i make a calculated sum I only get the SUM of the order rows with the dimension set id and not the entire order value which i need.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

My question is; how do I make a new column that sets the Dimension set ID for all order lines if Dimension set ID is true in ANY of the orderlines for the same order?

example of table

I tried using the IF function to find all order numbers but with no luck since the row only references itself and therefore, if the dimension set ID is blank, no value is given:

IF(‘Table'[Dimension Set ID]>0,’Table'[Order_no],"")

>Solution :

Best option is to do this in Power Query with the Fill down option. See Fill values in a column.

Otherwise, the DAX Calculated Column could look like:

IF(
  'Table'[Dimension Set ID] > 0,
  'Table'[Dimension Set ID],
  CALCULATE(
    MAX('Table'[Dimension Set ID]),
    ALLEXCEPT('Table', 'Table'[Order_no])
   )
)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading