Forum Discussion

SWATIC's avatar
SWATIC
Regular Visitor
5 years ago
Solved

PREVIOUS DAYS VALUE WITH CURRENT DATE VALUE

I want to show previous days value with current days value.

Tried below formula but in previous days value shown same as current days value. Particular issue is still pending.

 

Created Date table :-

1 :- date = CALENDARAUTO()

2 :- Previous Price = CALCULATE(average('BRAND WISE PRICE-VERT'[PRICE1]),DATEADD('date'[Date].[Date],-1,MONTH))
 
for e.g.
DATEPRODUCTCURRENT DAY PRICEPREVIOUS DAYS PRICE
01-12-2020A9000
02-12-2020B600900
03-12-2020C150600
04-12-2020D200150
 
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi SWATIC 

    Please check whether you build a relationship between BRAND WISE PRICE-VERT  Table and Data table by Date column.

    I have a test by your calculated column:

    PREVIOUS DAYS PRICE = CALCULATE(average('BRAND WISE PRICE-VERT'[CURRENT DAY PRICE]),DATEADD('date'[Date],-1,MONTH))

    It works well.

    If we delete the relationship, it will make the result to show previous price equal to current price.

    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. 

6 Replies

  • SWATIC , Do not use .date, try like

    Day behind Sales = CALCULATE(average('BRAND WISE PRICE-VERT'[PRICE1],dateadd('Date'[Date],-1,Day))
    Day behind Sales = CALCULATE(average('BRAND WISE PRICE-VERT'[PRICE1],previousday('Date'[Date]))

     

    • SWATIC's avatar
      SWATIC
      Regular Visitor

      Sorry Sir not resolve issue, shown below error :

       
      1st formula :-
      Previous Price1 = CALCULATE(AVERAGE('BRAND WISE PRICE-VERT'[PRICE1],PREVIOUSDAY('date'[Date])))

      Error :- Too many arguments were passed to the AVERAGE function. The maximum arguments count for the function is 1.

       

      2nd formula :- Not resolved same price shown in previous column.
      Previous Price = CALCULATE(average('BRAND WISE PRICE-VERT'[PRICE1]),DATEADD('date'[Date],-1,day))

       

       

  • SWATIC , make sure you are using the date from the calendar. Find the attached file after signature.

     

    Also when you add a product. None of the product on the sample has value for last day, so you will get two rows, one for current and one for the next day for last day

     

    • SWATIC's avatar
      SWATIC
      Regular Visitor

       

      Yes using below date :

       

      Created Date table :-

      1 :- date = CALENDARAUTO()

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi SWATIC 

        Please check whether you build a relationship between BRAND WISE PRICE-VERT  Table and Data table by Date column.

        I have a test by your calculated column:

        PREVIOUS DAYS PRICE = CALCULATE(average('BRAND WISE PRICE-VERT'[CURRENT DAY PRICE]),DATEADD('date'[Date],-1,MONTH))

        It works well.

        If we delete the relationship, it will make the result to show previous price equal to current price.

        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. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi SWATIC 

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

     

    Best Regards,

    Rico Zhou