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

Power BI Datasets

I'm creating a current and prior year trend chart using measures from another Power BI Dataset as a source.  The Prior Year measure used from the other dataset is not showing the actual prior year event counts.  Instead, it is also showing the current event counts.

The PY calculation from the other dataset is as follows:  

PYEvents = CALCULATE(DOWNTIME_EVENTS_BY_DEPARTMENT[TotalEvents], DATEADD(DateDim[Date],-1,YEAR ))
In my data model, i have a relationship between DOWNTIME_EVENTS_BY_DEPARTMENT and the Date table (DateDim).
 
Anyone know why the PY measure from the other dataset is not displaying the prior year counts?
 
fyi - i've tried to re-create a separate PY measure but I'm getting 'DATEADD' is expecting a contiguous selection error
 
Thanks!
4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Ensure tha the DOWNTIME_EVENTS_BY_DEPARTMENT column:

  1. Has proper dates (and not dates stored as text entries)
  2. Does not have time stamps

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
rrhascall
Helper II
Helper II

Thanks for your reply. 

Date table should be ok.  It is generated based on Calendar function.  Has lots of future dates and contains more historical dates than my event data:

DateDim =
VAR BaseCalendar =
CALENDAR( Date(2017, 1, 1), Date(2040,12,31))
 
There are gaps in the Event data but trending works fine in the source .pbix workbook/dataset.  My real dilema is why the PY event counts in the linked dataset are not correct when used
in the destination workbook.

I'd follow @Ashish_Mathur suggestion and make sure date columns in your new model are all set as Date and not Datetime. If that doesn't work come back and we'll see if we can dig deeper 🙂



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
bcdobbs
Super User
Super User

Based on the error I'd start by checking your date table. Date time functions require full years. Eg even if you only step over onto 2nd of january your date table would need all dates in that year.

It's also possible that your date table is missing some dates.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

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.