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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

days sale last year not coming out right ( fetch max date as last processed date)

Hi Team, 

 

I have been struggling since a week for this. 

 

Below is showing proper results: 

Total Sales CY Yesterday = CALCULATE([Total Sales CY], LASTDATE('Financial Data'[date_dt]))

(Total Sales CY = CALCULATE([Total Sales],'Financial Data'[Year] = YEAR(TODAY()) )

 

THIS IS NOT WORKING (below) 

If i try 

Method 1:

Total Sales LY Yesterday = CALCULATE([Total Sales],FILTER(('Financial Data'),'Financial Data'[date_dt]= [Last processed date LY]))

 

(Last processed date LY = DATE(YEAR(TODAY())-1,MONTH(TODAY()),DAY(LASTDATE('Financial Data'[date_dt])))

 

Method 2: 

 

Total Sales LY Yesterday2 = CALCULATE([Total Sales LY], FILTER(('Financial Data'), 'Financial Data'[date_dt].[Date]=[sameperiod last year]))

(

Total Sales LY = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Financial Data'[date_dt].[Date]))

sameperiod last year = DATE(YEAR(NOW())-1,MONTH(NOW()), DAY([Last processed date CY]))

)

 

both methodsdidnt work. 

 

last_processed.JPGCapture.JPG

 

Am using lastdate function because for monday (i cant use sundays data -which would be blank) i need to process lastdate which has sales

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Actually, I resolved it !!! Total Sales LY Yesterday = CALCULATE([Total Sales], SAMEPERIODLASTYEAR(LASTDATE('Financial Data'[date_dt])))

View solution in original post

4 REPLIES 4
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

Can you share a sample, please? The formula looks good. Didn't it return the expected result? 

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I cant share the sample since data is confidential.

how can i resolve it otherwise

Hi @Anonymous,

 

Can you make some dummy data? I would also suggest you try to add a date table that is necessary for the time intelligence functions.

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Actually, I resolved it !!! Total Sales LY Yesterday = CALCULATE([Total Sales], SAMEPERIODLASTYEAR(LASTDATE('Financial Data'[date_dt])))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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