Forum Discussion

ghost10's avatar
ghost10
Frequent Visitor
3 years ago
Solved

Range end close price

Hi Team , I am working working on some power bi reports. Actually I want to know how can we derive close end price for the perticular month based on id and date. using dax only.  
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi ghost10 ,

     

    Due to I don't know your data model, I create a sample to have a test.

    My Sample:

    YearMonth is a calcualted column.

    YearMonth = YEAR([Date])*100+MONTH([Date])

    Measure:

    Range end close price =
    CALCULATE (
        SUM ( 'Table'[Price] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[ID], 'Table'[YearMonth] ),
            'Table'[Date] = MAX ( 'Table'[Date] )
        )
    )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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