Forum Discussion
Anonymous
4 years agoNot applicable
How to compare two Rows value in same table and assign a value in a separate column based on it
Hi Team, I need help in below logic: I have three tables: Orders table (Contains 1 row per orders placed with customer and revenue data as whole) Order line items table (Contains brief Orde...
- 4 years ago
Anonymous
Please useColumn = VAR Brand = CALCULATE ( SELECTEDVALUE ( 'Order Line Items'[Brand] ) ) RETURN IF ( ISBLANK ( Brand ), "Mixed Order", Brand )
tamerj1
4 years agoCommunity Champion
Hi Anonymous
Suppose you have a one way relationhip (One to Many) between 'Orders' and 'Order Line Items' then you my try
Calculated Brand Column =
CONCATENATEX (
RELATEDTABLE ( 'Order Line Items' ),
IF (
HASONEVALUE ( 'Order Line Items'[Brand] ),
'Order Line Items'[Brand],
"Mixed Order"
)
)Anonymous
4 years agoNot applicable
Hi tamerj1
I tried the solution provided by you, but in my case it is not returning the expected value. When I am applying the DAX provide by you above, it is returning the values as in the screenshot below:
We need a little modification in the logic.
- tamerj14 years agoCommunity Champion
Hi Anonymous
Please tryCalculated Brand Column = VAR Check = SUMX ( RELATEDTABLE ( 'Order Line Items' ), IF ( HASONEVALUE ( 'Order Line Items'[Brand] ), 1 ) ) RETURN IF ( Check >= 1, VALUES ( 'Order Line Items'[Brand] ), "Mixed Order" )- Anonymous4 years agoNot applicable
Hi tamerj1 ,
It is still only giving all values as "Mixed Order". Please see the screenshot below:
Can we compare orders column with Brand column, like if One Order is having multiple brand purchased together it returns "Mixed Order" else "Brand"?- tamerj14 years agoCommunity Champion
Anonymous
Can you please create a columnCOUNTROWS ( RELATEDTABLE ( 'Order Line Items' ) )and let me know what results you get