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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
perezco
Advocate III
Advocate III

"power bi" inactive relation for two fact tables same column (order_id)

under table1 ('Fact - order') I tried create the below column

Column order = CALCULATETABLE( LASTNONBLANK('Fact - order'[order_wid],'Fact - order'[order_wid]),USERELATIONSHIP('Fact - order'[order_wid],'Fact - order Parts'[order_wid]))


two fact order tables (relationship is inactive but 1 --->> *, I need   1 <<---*    because my intention is that any part is been choosen in table two will brings the orders from table 1 and their commodity, is this possible?

table one                                                             table two
order_ID - commodities   1<<---need be----*   order_id -parts# - partsQties
(unique values)                                                    (many)


----extra 

the commodity brings somehing like this 
Hard Drive-XXW34 :(2)

1 ACCEPTED SOLUTION
v-zhouwen-msft
Community Support
Community Support

Hi @Cperota ,thanks for the quick reply.

Hi @perezco ,

Regarding your question, I made an attempt.

The Table data is shown below:

vzhouwenmsft_0-1713322242395.png

vzhouwenmsft_1-1713322258103.png

vzhouwenmsft_2-1713322293951.png

Please follow these steps:

1.Modify the filter passing direction

vzhouwenmsft_3-1713322362670.png

2.Use the following DAX expression to create a measure

Measure = CALCULATE(SELECTEDVALUE('Fact - order'[Product]),USERELATIONSHIP('Fact - order Parts'[order_wid],'Fact - order'[order_wid]))

3.Final output

vzhouwenmsft_4-1713322468145.png

vzhouwenmsft_5-1713322482511.png

vzhouwenmsft_9-1713322573465.png

vzhouwenmsft_10-1713322591161.png

vzhouwenmsft_11-1713322601322.png

vzhouwenmsft_12-1713322625012.png

 

Best Regards,
Wenbin 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

3 REPLIES 3
v-zhouwen-msft
Community Support
Community Support

Hi @Cperota ,thanks for the quick reply.

Hi @perezco ,

Regarding your question, I made an attempt.

The Table data is shown below:

vzhouwenmsft_0-1713322242395.png

vzhouwenmsft_1-1713322258103.png

vzhouwenmsft_2-1713322293951.png

Please follow these steps:

1.Modify the filter passing direction

vzhouwenmsft_3-1713322362670.png

2.Use the following DAX expression to create a measure

Measure = CALCULATE(SELECTEDVALUE('Fact - order'[Product]),USERELATIONSHIP('Fact - order Parts'[order_wid],'Fact - order'[order_wid]))

3.Final output

vzhouwenmsft_4-1713322468145.png

vzhouwenmsft_5-1713322482511.png

vzhouwenmsft_9-1713322573465.png

vzhouwenmsft_10-1713322591161.png

vzhouwenmsft_11-1713322601322.png

vzhouwenmsft_12-1713322625012.png

 

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

 

 

 

Cperota
New Member

did you try lookup function ?>> The lookup   function is a good option when you need a single column.
https://www.sqlbi.com/articles/lookup-multiple-values-in-dax/

thanks, @Cperota

The table 2  'Fact - order Parts' is the one that need to get the column string values 'commodity description' from table 1 'Fact - order'.


To avoid inaccurate calculations, 
I am trying to  do it without USERELATIONSHIP function active /not active stage.
 

Column (inactive) =

ADDCOLUMNS (
'Fact - order Parts',
"commodity_desc",
VAR order_wid_ =
'Fact - order Parts'[order_wid]  //----->my issue here - I have mutiple wo_id
RETURN
LOOKUPVALUE (
'Fact - order'[commodity_desc],
'Fact - order'[order_wid], 'Fact - order Parts'[order_wid],
'Fact - order'[order_wid], order_wid_
) ,
"TREATAS connection",
VAR A_treatas =
TREATAS( VALUES('Fact - order'[order_wid]), 'Fact - order Parts'[order_wid])
RETURN
A_treatas
)

-------------------------------------------

note: I am having proble to answer @v-zhouwen-msft . I dont understand my message keep be deleted it.

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.