Forum Discussion
amarsale85
5 years agoHelper II
PATHCONTAINS and Multiple selected value
Hi Experts, i have created below measure to calculate aggregated profit amount for locations at parent level (like Continent, Country, Province) which would be summation of children cities. Our D...
Greg_Deckler
5 years agoCommunity Champion
amarsale85 If you are having trouble with lbendlin 's suggestion, which is a good one, see Text to Table: https://community.powerbi.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/1312929#M594
amarsale85
5 years agoHelper II
Thank you lbendlin for your suggestion but it isn't working. Below is my code:
Sum Amount:=
VAR SelectedLocations =
SELECTCOLUMNS(
VALUES(DimLocation),
"LocationID", DimLocation[LocationID]+0
)
VAR mytable =
SELECTCOLUMNS (
GENERATE (
ALL(DimLocation),
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( [Calculated Path] ) ),
"PivotPath", PATHITEM ( [Calculated Path], [Value], 1 )
)
),
"LocationID", DimLocation[LocationID]+0,
"PivotPathKey", [PivotPath]
)
RETURN
CALCULATE (
SUM(FactAmount[Amount]),
INTERSECT(mytable,SelectedLocations)
)This code gives me error.
I used INTERSECT here, but it gives error since these 2 tables have different no. of columns. If i used NATURALINNERJOIN instead of INTERSECT, that gives an error as well.
Can you suggest what else can be used in place of INTERSECT() ?
Regards,
Amar
- lbendlin5 years agoSuper User
In the Intersect wrap your "myTable" table into another SelectColumns() so that it matches the structure of the other table.