Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
SWATIC
Regular Visitor

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
 
1 ACCEPTED SOLUTION

Hi @SWATIC 

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

1.png

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.

2.png

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

3.png

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. 

View solution in original post

6 REPLIES 6
v-rzhou-msft
Community Support
Community Support

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

amitchandak
Super User
Super User

@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

 

 

Yes using below date :

 

Created Date table :-

1 :- date = CALENDARAUTO()

Hi @SWATIC 

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

1.png

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.

2.png

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

3.png

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. 

amitchandak
Super User
Super User

@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]))

 

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))

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.