HI all,
I am having some trouble with grouping / binning type analysis. My data has the following columns of interest.
Property ID: = Text string unique for each property
Asset ID: = Whole number unique to each asset. Multiple assets belong to each property
Value:= The value of each asset
Type:= A text string descriptor of a unit type
I need to filter by viz by the Type of Property (not the Type of unit, which is given in the column Type). The type for a property is the type of it's highest value asset. So for each row I need to filter the table for all the assets that have the same property ID, find the max value, and look up the associated type.
I started with a simple LOOKUPVALUE, filtered to show all the matching Property IDs, but that failed because there are ties in the max values. After much futzing around I've come up with this monstrosity.
I've used the Asset ID as a tie breaker as these are unique. However, while this works in Power BI, I need to use in Excel Power Pivot 2013, and it doesn't seem to like the MAX applied to a string.
Any help with 1. how to get past this specific issue, and 2. the proper way to do this calculation, I'd be very grateful.
I am having some trouble with grouping / binning type analysis. My data has the following columns of interest.
Property ID: = Text string unique for each property
Asset ID: = Whole number unique to each asset. Multiple assets belong to each property
Value:= The value of each asset
Type:= A text string descriptor of a unit type
I need to filter by viz by the Type of Property (not the Type of unit, which is given in the column Type). The type for a property is the type of it's highest value asset. So for each row I need to filter the table for all the assets that have the same property ID, find the max value, and look up the associated type.
I started with a simple LOOKUPVALUE, filtered to show all the matching Property IDs, but that failed because there are ties in the max values. After much futzing around I've come up with this monstrosity.
Code:
CALCULATE (
CALCULATE (
VALUES ( Table[Type] ),
FILTER (
FILTER (
ALLEXCEPT (Table, Table[Property ID]),
Table[Asset ID] = MAX ( Table[Asset ID] )
),
Table[Value] = MAX ( Table[Value] )
),
ALLEXCEPT (Table, Table[Property ID])
)
)
I've used the Asset ID as a tie breaker as these are unique. However, while this works in Power BI, I need to use in Excel Power Pivot 2013, and it doesn't seem to like the MAX applied to a string.
Any help with 1. how to get past this specific issue, and 2. the proper way to do this calculation, I'd be very grateful.