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
Purnima_Pandey
New Member

CALENDAR(date(Year(today())-1,1,1),today()) doesn't work for 2019. Please help!

Dear all

 

We were using the below measures for calcuating the Sales for current year vs previous year for 2017-18.  This was working perfectly fine for 2017-18. But the same is not working for 2018-19

 

DatesCalc = CALENDAR(date(Year(today())-1,1,1),today())

Sales_CY = CALCULATE([Total_Sales],FILTER(DatesCalc,year(DatesCalc[Date])=Year(today())))

Sales_PY = CALCULATE([Total_Sales],SAMEPERIODLASTYEAR(DatesCalc[Date]))

 

Currently we aren't able to view the 2019 data. The weird part here is this happens only for the Location based Sales data and not for the category based sales data. There is no change in the DB struture for 2019 vs 2018 r 2017 data. Any help here will be more appreciated. My org is not able to view the data 😞

 

PS: Since we have multiple DB's we had to group them and use a common measure to get the result.

 

Regards

Purnima

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

Try this new Table formula: DatesCalc = CALENDAR(MIN(Data[Date]),today()).  In this DatesCalc table, write this calculated column formula: Year=YEAR(Calendar[Date]).  Create a relationship from the Date column of the Data Table to the Date column of the DatesCalc table.

 

In your visual, drag the Year column from the Calendar Table.  Write these measures

 

Sales_CY = SUM(Data[Sales])

Sales_PY = CALCULATE([Sales_CY],SAMEPERIODLASTYEAR(Calendar[Date]))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
MFelix
Super User
Super User

Hi @Purnima_Pandey,

 

First of all check in the table view if you are abble to see the 2019 data, if not try to check the database. If you are abble to see the 2019 data in the table view see if you have any filter on your reports that is slicing the data for only 2018.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.