Forum Discussion
Make Chart Using Latest ID Based On User Selected Date
- Anonymous2 years ago
Hi alee5210
Please try this:
First of all, I create a measure:
Effective = VAR _currentDate = MAX ( 'Table'[Effective Start Date] ) VAR _currentCountier = SELECTEDVALUE ( 'Table'[Courier] ) VAR _currentID = MAX ( 'Table'[Parcel ID] ) VAR _vtable = FILTER ( ADDCOLUMNS ( ALLSELECTED ( 'Table' ), "_Maxdate", MAXX ( FILTER ( ALLSELECTED ( 'Table' ), [Parcel ID] = EARLIER ( 'Table'[Parcel ID] ) && [Courier] = EARLIER ( 'Table'[Courier] ) ), [Effective Start Date] ) ), [Effective Start Date] = [_Maxdate] ) RETURN SUMX ( FILTER ( _vtable, [Courier] = MAX ( 'Table'[Courier] ) ), [Mass] )The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi alee5210
Please try this:
First of all, I create a measure:
Effective =
VAR _currentDate =
MAX ( 'Table'[Effective Start Date] )
VAR _currentCountier =
SELECTEDVALUE ( 'Table'[Courier] )
VAR _currentID =
MAX ( 'Table'[Parcel ID] )
VAR _vtable =
FILTER (
ADDCOLUMNS (
ALLSELECTED ( 'Table' ),
"_Maxdate",
MAXX (
FILTER (
ALLSELECTED ( 'Table' ),
[Parcel ID] = EARLIER ( 'Table'[Parcel ID] )
&& [Courier] = EARLIER ( 'Table'[Courier] )
),
[Effective Start Date]
)
),
[Effective Start Date] = [_Maxdate]
)
RETURN
SUMX ( FILTER ( _vtable, [Courier] = MAX ( 'Table'[Courier] ) ), [Mass] )
The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is amazing! Exactly what I was after!
To expand on this, is there a way for me to take this farther. Let's say I have another column and I want to do a count on that column but again using only the latest records. Will I have to create another measure? Is there any way to achieve this in a simpler way, especially if I plan on making many different visuals? For example, I might want to do a count instead of a sum and I don't want to create a new measure each time since they would almost be the same.