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
rajanimaddala
Helper II
Helper II

Last year measure not displaying all results

Hi,

I have a dataset to show revenues by products.

I have a measure(Actual Recognised YTD) to calculate Revenue this year by product.

I need to calculate revenue for last year.

My measure for LY is like

Recognised Revenue Last Year =

var currentFYStartDate = MIN(TrueSales_DeferredRevenue[Transaction Date])

var CurrentFYEndDate = MAX(TrueSales_DeferredRevenue[Transaction Date])

RETURN CALCULATE('TrueSales_DeferredRevenue'[Actual Recognised YTD], FILTER(ALL('TrueSales_DeferredRevenue'), TrueSales_DeferredRevenue[Transaction Date] <= DATE(YEAR(CurrentFYEndDate)-1, MONTH(CurrentFYEndDate), DAY(TODAY())) && TrueSales_DeferredRevenue[Transaction Date] >= DATE(YEAR(currentFYStartDate)-1,8,1) && 'TrueSales_DeferredRevenue'[Product] IN VALUES('TrueSales_DeferredRevenue'[Product]) && TrueSales_DeferredRevenue[Region] IN VALUES(TrueSales_DeferredRevenue[Region]) && TrueSales_DeferredRevenue[Product Group Description] IN VALUES(TrueSales_DeferredRevenue[Product Group Description])))

This year revenues are fine. Only issue with Last Year.

Last Year revenue is working only for products which has revenue this year. If the revenue for a product for this year is non 0, Last year revenue is dhowing otherwise showing as 0(Last Year Revenue)

I have selected Products(Show items with no data) but no luck

What is the issue?

Please reply

Thanks in advance

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Is it possible to use datesyts and totalytd. You can mention year-end in case year does not end at 12/31.

You need to have a calendar table for that.

example

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"3/31"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"3/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"3/31"))

Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
2 Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(sales,sales[date] <=maxx(date,date[date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

 

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

Is it possible to use datesyts and totalytd. You can mention year-end in case year does not end at 12/31.

You need to have a calendar table for that.

example

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"3/31"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"3/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"3/31"))

Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
2 Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(sales,sales[date] <=maxx(date,date[date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

 

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.