Forum Discussion
Misunderstanding Lookupvalue
- 9 years ago
Anonymous
There are several things you can do first
Last Score Measure 1 = CALCULATE ( LASTNONBLANK ( 'Table'[Score], 1 ), VALUES ( 'Table'[Student] ), LASTDATE ( 'Table'[Date] ) )Or you can imporve the above by calculating the average score for all students that took a test on the last day to be displayed in the total row
Last Score Measure 2 = IF ( HASONEVALUE ( 'Table'[Student] ), CALCULATE ( LASTNONBLANK ( 'Table'[Score], 1 ), VALUES ( 'Table'[Student] ), LASTDATE ( 'Table'[Date] ) ), DIVIDE ( CALCULATE ( SUM ( 'Table'[Score] ), VALUES ( 'Table'[Student] ), LASTDATE ( 'Table'[Date] ) ), CALCULATE ( DISTINCTCOUNT ( 'Table'[Student] ), LASTDATE ( 'Table'[Date] ) ), 0 ) )My Measures work with or without a separate student table!
Hope this helps! :smileyhappy:
Anonymous
hi, please try something like this:
A measure:
LastScore=If(HasOneValue(Table[User]),Calculate(Values(Table[TestScore]),Filter(Table, Table[TestDate]=[Last Test Date])))
Thanks for that, it only works if the user has a single test date though. I want to be able to find the last result from a list.
- Vvelarde9 years agoCommunity Champion
Anonymous
Hi, asuming you have a similar relationship to this:
Test Table
Create a measure:
LastScore = VAR LastTestDate = LASTDATE ( Test[TestDate] ) RETURN IF ( HASONEVALUE ( Users[User] ), CALCULATE ( VALUES ( Test[TestScore] ), FILTER ( Test, Test[TestDate] = LastTestDate ) ) )- Anonymous9 years agoNot applicable
Thanks Very much for your help,
That's the structure of my data but it's still not working. I'm going to create some dummy data to see if I can get to the bottom of the problem.
Wiredchop
- Anonymous9 years agoNot applicable
Ok, I've created the simplest example I could but it's not working!?!?!
Really puzzling me why this isn't working. It seems like it should be so simple!
Thanks again for your help,