Forum Discussion
samlopez313
5 years agoMicrosoft Employee
Getting row level context to DAX formula
Hi I have a pivot table that has a rows as Area and then SubArea. I'm creating a URL that has the Area on the link concatenated, but I want to use the subarea when needed, e.g. when a u...
- 5 years ago
This is a situation where ISINSCOPE is useful.
You could use it like this:
Context = IF ( ISINSCOPE ( Table1[SubArea] ), SELECTEDVALUE ( Table1[SubArea] ), SELECTEDVALUE ( Table1[Area] ) )
AlexisOlson
5 years agoSuper User
What does your existing measure look like?
samlopez313
5 years agoMicrosoft Employee
I'm creating this as a column and this is the formula:
URL =
VAR context = IF(ISINSCOPE(Table1[Area]),SELECTEDVALUE(Table1[Area]),SELECTEDVALUE(Table1[SubArea]))
RETURN
CONCATENATE(CONCATENATE("https://contoso.",context),".com")This is the current result:
As you can see the hyperlink is not concatenated correctly as it seems that "context" is empty. If I collapse the fields to the Area level it behaves the same.
- AlexisOlson5 years agoSuper User
I meant the measure you had that just worked with just the Area. What does that look like?
Note that I wouldn't expect the expression I gave to work as a calculated column (since the scope is created by the visual). It has to be a measure.
- samlopez3135 years agoMicrosoft Employee
Got it, yes! While you were responding I created the measure instead of the column and this is working great! Thanks!