Excel PowerPivot calculated column equivalent to an array formula

jmwbowen

Board Regular
Joined
Jul 27, 2012
Messages
58
Hello,

I'm new to PowerPivot and trying to learn a few things. I have a workbook with several tables that are related to each other through primary/foreign keys.

One of the tables has an array formula field that find's a person's current location by:

looking through a list of travel movements, finding all travel movement rows where the person's name matches the name on the original table, finding the row with the newest date, and then using the "location" on that row.

What would be an equivalent formula for this in PowerPivot?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
There are several ways. Do you have a separate date table or are you relying on the date in the travel movements?

Without knowing the table structure it's hard to know the most effective, but you'd like to find the last movement date for the selected user and get the associated location. Some pseudo code would be
VBA Code:
[Current Location] :=
CALCULATE (
    FIRSTNONBLANKVALUE ( MovementTable[Location], 1 ),
    FILTER (
        ALL ( MovementTable ),
        MovementTable[EventDate] = LASTDATE ( MovementTable[EventDate] )
            && MovementTable[Name] = SelectedName
    )
)
But of course it might vary depending on where you're taking the date from and how you're choosing the name.
 
Upvote 0

Forum statistics

Threads
1,223,793
Messages
6,174,624
Members
452,575
Latest member
Fstick546

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top