Forum Discussion
Latest Record Based on Date Slicer
- 6 years ago
Hi Anonymous
Check if it is correct on your side.
Create a new table
attribute = VALUES('Log'[Attribute])Modify measure as below
attribute selected = VAR maxdate = CALCULATE ( MAX ( 'Log'[Record Date] ), FILTER ( ALLSELECTED ( 'Log' ), 'Log'[Employee ID] = MAX ( 'Log'[Employee ID] ) && 'Log'[In View] = 1 ) ) VAR attr = CALCULATE ( MAX ( 'Log'[Attribute] ), FILTER ( ALLSELECTED ( 'Log' ), 'Log'[Employee ID] = MAX ( 'Log'[Employee ID] ) && 'Log'[Record Date] = maxdate ) ) RETURN IF ( HASONEFILTER ( attribute[Attribute] ), IF ( SELECTEDVALUE ( attribute[Attribute] ) = attr, attr ), attr )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
Check the pbix file.
last index in view =
VAR maxdate =
CALCULATE (
MAX ('Log'[Record Date] ),
FILTER (
ALLSELECTED ( 'Log' ),
'Log'[Employee ID]
= MAX ( 'Log'[Employee ID] )
&& 'Log'[In View]
= 1
)
)
RETURN
CALCULATE (
MAX ('Log'[Index] ),
FILTER (
ALLSELECTED ( 'Log' ),
'Log'[Employee ID]
= MAX ('Log'[Employee ID] )
&& 'Log'[Record Date] = maxdate
)
)
attribute selected =
VAR maxdate =
CALCULATE (
MAX ( 'Log'[Record Date] ),
FILTER (
ALLSELECTED ( 'Log' ),
'Log'[Employee ID]
= MAX ( 'Log'[Employee ID] )
&& 'Log'[In View]
= 1
)
)
RETURN
CALCULATE (
MAX ( 'Log'[Attribute] ),
FILTER (
ALLSELECTED ( 'Log' ),
'Log'[Employee ID]
= MAX ( 'Log'[Employee ID] )
&& 'Log'[Record Date] = maxdate
)
)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey Maggie,
Thanks again for attempting again and correcting the syntax. I am however getting the same results as my measure. Screenshots are below. The issue is that when applying a slicer for attribute 1, it is returning all the employees that at one point have had a 1 in the table, not just the employees that have a 1 on the date selected in the slicer.
- v-juanli-msft6 years ago
Community Support
Hi Anonymous
Check if it is correct on your side.
Create a new table
attribute = VALUES('Log'[Attribute])Modify measure as below
attribute selected = VAR maxdate = CALCULATE ( MAX ( 'Log'[Record Date] ), FILTER ( ALLSELECTED ( 'Log' ), 'Log'[Employee ID] = MAX ( 'Log'[Employee ID] ) && 'Log'[In View] = 1 ) ) VAR attr = CALCULATE ( MAX ( 'Log'[Attribute] ), FILTER ( ALLSELECTED ( 'Log' ), 'Log'[Employee ID] = MAX ( 'Log'[Employee ID] ) && 'Log'[Record Date] = maxdate ) ) RETURN IF ( HASONEFILTER ( attribute[Attribute] ), IF ( SELECTEDVALUE ( attribute[Attribute] ) = attr, attr ), attr )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.