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
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
- Olenard5 years agoHelper III
Great one ! The only thing is that this is an iterative (line by line) formula. Then quite resource consuming!
But if there is no solution with an inactive relationship (seems like it does not work with the calculated column), this is the solution