Forum Discussion
Inactiv Relationship in Calculated column
- 5 years ago
Olenard , In the case of a column related, will not work with inactive relation, and use relation might not work well.
You can use lookupvalue or can use a formula like this
City Name = maxx(FILTER(geography,geography[City Id]=Sales[City Id]),geography[City])
refer to this video : https://www.youtube.com/watch?v=czNHt7UXIe8
- 5 years ago
Anonymous
Of course you can change the active relationship when doing calculations in a table. For instance, if you have a simple model like:
with the relationship inactive, you can create the calculated column:
Res = CALCULATE(SUM(Table1[Col1]), USERELATIONSHIP(DimT[Col1],Table1[Col1]))on table DimT, which will work fine using the otherwise inactive relationship.
It is true that it won't work with RELATED( ) as I suggested earlier but that has nothing to do with USERELATIONSHIP( ) but rather with CALCULATE( ). RELATED( ) requires a row context and that will be lost through context transition when using CALCULATE( ). A calc column in Table1 such as:
New col = CALCULATE( RELATED(DimT[Col2]) )with the an active relationship will not work either, precisely for that reason, while this would:
New col = RELATED( DimT[Col2] )Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
The right way to solve this is to enable Two-Ways filtering in the inactive relationship and use the USERELATIONSHIP in the FILTER.
All the other answers are ugly workarounds.