Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
griffin2571
Contributor
Contributor

Eliminating Records with Max Dimension

I have two records with the same Vin number but only want to show the most recent date. If i eliminated Column "Type of Repair" then it'll eliminate the record that isn't the Max Date. However, now I have a two different attributes in Type of Repair Account. 

Status Car Vin Job Description Comments Drop Off Date Type of Repair
In Shop  82000917 Oil Change   2022-09-30 Drop off
In Shop  82000917 Oil Change   2022-06-01 Unplanned

Currently this is my script for Drop off Date.

=Date(Aggr(Max(TOTAL [Drop Off Date]),[Car Vin],[Drop Off Date]),'YYYY-MM-DD')

What script would i need for Type of Repair to only show

Status Car Vin Job Description Comments Drop Off Date Type of Repair
In Shop  82000917 Oil Change   2022-09-30 Drop off

 

Labels (6)
2 Replies
G3S
Creator III
Creator III

no script necessary for Drop Off Date, just the field is enough.   Try this for Type Of Repair (and untick 'Include null values' tick box)

if(aggr(max(date([Drop Off Date],'DD/MM/YYYY')),"Car Vin")=[Drop Off Date],"Type of Repair")

vinieme12
Champion III
Champion III

Option1)  Using Max()

Dimensions

Status

CarVin

JobDescription

Comments

DropOffDate = aggr(if(Max(DropOffDate)= Max(Total <CarVin> DropOffDate),DropOffDate) ,CarVin,DropOffDate)   << Uncheck Include Null Values for this dimension

TypeOfRepair

 

 

OR

Option2)  Using FirstSortedValue()

Dimensions

Status

CarVin

JobDescription

Comments

DropOffDate = aggr(FirstSortedValue( DropOffDate,-DropOffDate),CarVin)  << Uncheck Include Null Values for this dimension

Measure

TypeOfRepair = FirstSortedValue(TypeofRepair,-DropOffDate)

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.