Forum Discussion
DataCruncher123
4 years agoFrequent Visitor
Calculated Column based on three other columns
Hello, I want to create a column (red circle) that detects when there is the same date and car type and then take the max "km stand" and substract the min "km stand" for this selections and ad...
- 4 years ago
Hi,
Here you go:Distance = var car = 'Car distance'[Car]var _date = 'Car distance'[Date] returnvar maxDistance = CALCULATE(MAX('Car distance'[KM]),all('Car distance'),'Car distance'[Date]=_date,'Car distance'[Car]=car)var minDistance = CALCULATE(Min('Car distance'[KM]),all('Car distance'),'Car distance'[Date]=_date,'Car distance'[Car]=car)returnmaxDistance-minDistance
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
ValtteriN
Community Champion
4 years agoHi,
Here you go:
Distance = var car = 'Car distance'[Car]
var _date = 'Car distance'[Date] return
var maxDistance = CALCULATE(MAX('Car distance'[KM]),all('Car distance'),'Car distance'[Date]=_date,'Car distance'[Car]=car)
var minDistance = CALCULATE(Min('Car distance'[KM]),all('Car distance'),'Car distance'[Date]=_date,'Car distance'[Car]=car)
return
maxDistance-minDistance
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
DataCruncher123
4 years agoFrequent Visitor
Thanks for quick support, it works now 🙂