Forum Discussion

kamalbandam's avatar
kamalbandam
Icon for Helper III rankHelper III
4 years ago
Solved

Sort as per date column in measure

Hi   I have a table as following: Date No of Days Type 12-Nov-2020 12 A 30-Jan-2021 5 B 4-Apr-2020 8 C 5-May-2021 2 S 6-Aug-2021 22 A     Now, I need to...
  • v-angzheng-msft's avatar
    4 years ago

    Hi, kamalbandam 

    Try to create a measure like this:

    Measure = 
    var _date_S=CALCULATE(MIN('Table'[Date]),FILTER(ALL('Table'),'Table'[Name]=MAX('Table'[Name])&&'Table'[Type]="S"))
    var _sum=CALCULATE(SUM('Table'[No of Days]),FILTER(ALL('Table'),'Table'[Name]=MAX('Table'[Name])&&'Table'[Date]<_date_S&&'Table'[Date]<=MAX('Table'[Date])))
    
    return _sum
    

     

    Result:

    Please refer to the attachment below for details. Hope this helps.

     

     

     

    Best Regards,
    Community Support Team _ Zeon Zheng


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.