Report with related table using a Select() function

In the process of creating a report to run at monthโ€™s end of employee mileage. The app is set up with a 1:M type of relationship. Employee table with a Reference column to the mileage table. I have a virtual column in the Employee table that works perfectly for what I want and that is pulling only those mileage records within the month using this select function:

Select(Mileage[Miles], And([Employee] = [_THISROW].[Employee], [Date] <=EOMONTH(TODAY(), 0),[Date] >=EOMONTH(TODAY(), -1)))

I am able to SUM that to get a total of miles per month per employee.

My report is nearly 100% except that for the life of me I canโ€™t get an expression to work to see the breakdown in the table of only the records pertaining to the current month. Everything I try using the [Related Mileages] reference column has been a bust also with the Select function at the top.

Solved Solved
0 6 243
1 ACCEPTED SOLUTION

Marc, virtual covid elbow bump.

That key column was the โ€œkeyโ€ to my undoing. This worked :

<<Start: Select([Related Mileages][Record ID], And([Date] <=EOMONTH(TODAY(), 0),[Date] >=EOMONTH(TODAY(), -1)))>><<[Date]>>

I havenโ€™t designed any super complicated apps for a few years now. Most of mine are now in the โ€œset it and forget itโ€ mode. Very out of practice! Tons of thanks.

View solution in original post

6 REPLIES 6

What if you took your SELECT expression:

And used that inside of <<START:โ€ฆ
But replace SELECT(Mileage[Miles] with FILTER(Mileage

Or in other words, I donโ€™t think that [Miles] in the key-column for the Mileage table, and START expressions require a list of key values.

I have definitely tried a few variations of that. The key column in the mileage table is a [Record ID] since it is kind of the only unique thing about that table.

Which โ€œStartโ€ are you referring to the one at the top of the report or embedded into the mileage table?

The Mileage Start.

You could also do

<<START: SELECT( [Related Mileages][Record ID] , And( [Date] <=EOMONTH(TODAY(), 0),[Date] >=EOMONTH(TODAY(), -1)) >>

Let me give that Select a go. The filter actually worked, except it was showing every record regardless of the employee. Thanks for the quick replies btw.

Probably needed to change [_THISROW] to [_THISROW-1]

Marc, virtual covid elbow bump.

That key column was the โ€œkeyโ€ to my undoing. This worked :

<<Start: Select([Related Mileages][Record ID], And([Date] <=EOMONTH(TODAY(), 0),[Date] >=EOMONTH(TODAY(), -1)))>><<[Date]>>

I havenโ€™t designed any super complicated apps for a few years now. Most of mine are now in the โ€œset it and forget itโ€ mode. Very out of practice! Tons of thanks.

Top Labels in this Space