Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Capture price changes

Hi,

I have below data, I would like to capture the changes of the price for each Part No:

 

 

I would like the result to be like below, capture the price whenever it changes:

can someone help please?

 

10 Replies

  • Anonymous 

    Can you try this  as a new column to your table and check

    Column = 
    
    VAR _PRICE = MAXX(FILTER('Table', 'Table'[Part No] = EARLIER('Table'[Part No]) && 'Table'[Date] < EARLIER('Table'[Date])), 'Table'[Pirce])
    VAR _PART= MAXX(FILTER('Table', 'Table'[Part No] = EARLIER('Table'[Part No]) && 'Table'[Date] < EARLIER('Table'[Date])), 'Table'[Part No])
    VAR CP = [Pirce]
    
    RETURN
    
    IF(           
        [Part No] = _PART ||( _PART=BLANK() && _PART <> BLANK()),
        [Pirce] , 
        BLANK() 
    )

     

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks @Fowmy , my data source is a tabular model, and the source table is very large, around 4 millions record, so I was trying to avoid adding calcualted column.

      Is there away to just do it in a measure or measures?

      • Anonymous's avatar
        Anonymous
        Not applicable

        One thing I forgot to menation that date column is from another table, but it is join with the part table.

  • Hi,

    One way could be that in the Query Editor, you may select all columns and then right click > Remove Duplicates.

    Hope this helps.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Ashish_Mathur , my report is connected to the tabular model, I can't use query editor.

      Thanks for your comment anyway.

    • Anonymous's avatar
      Anonymous
      Not applicable

      v-diye-msft is Ealiest Date a calculated column? can you please share the DAX.

       

      • v-diye-msft's avatar
        v-diye-msft
        Community Support

        Hi Anonymous 

         

        I didn't write DAX, just change the aggreate type of date column, you'll make it.