Forum Discussion

DataCruncher123's avatar
DataCruncher123
Frequent Visitor
4 years ago
Solved

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...
  • ValtteriN's avatar
    4 years ago

    Hi,

    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/