Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Parent child BoM

Hi all,

 

I have a large dataset which is a SQL and I'm only allowed to read the data, which is the first constraint.

The table in question contains stock items and each stock item has an parent stock item, which is the second constraint. 

 

This means that when I'm trying to create a PATH, the top parent has a top parent which is the same value, stupid enough. And therefore my DAX gets an error.

 

Can I somehow ignore if the parent and the child matches values and proceed with the path function or maybe even creating a calculated column that gives an empty value if they match and this becoming my new parent column?

 

Tried to outsmart this for a while with no success, so please feel free to help.

 

Now I'm rambling but, 

1 Reply

  • Anonymous 

    Your pull from SQL is simply a SELECT against the database so you can add fields onto it to clean up your problem field, someting like this.

     

    SELECT a.*,
    	CASE
    		WHEN a.Parent_Stock_Item = a.Stock_Item THEN 
    			NULL
    		ELSE 
    			a.Parent_Stock_Item 
    		END AS Clean_Parent_Stock_Item
    FROM YourSQLTable (NOLOCK) a