Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

The difference between the earliest two dates

Hello,    I have the table shown, I need a measure (1) that calculates the difference between the earliest two dates and measure (2) how many times the price changed.   https://docs.google.com/s...
  • ThxAlot's avatar
    2 years ago

    Simple enough,

    Cnt = 
    CALCULATE(
        COUNTROWS( 'PRICE' ),
        'PRICE'[#]
            <= MAXX(
                INDEX( 2, DISTINCT( 'PRICE' ), ORDERBY( 'PRICE'[Date], DESC ) ),
                'PRICE'[#]
            )
    ) - 1