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
bo_afk
Post Patron
Post Patron

Incorrect year in date hierarchy

Hi,

 

I have a date column in my data with the following format dd/mm/yyyy. However, in my date hierarchy, which was automatically created in Power BI, the years it's returning is incorrect.

 

It's showing years from 1901 to 2020, whereas in the data, I only have years 2017 to 2020. Anyone have an idea why it's appearing like this?

 

Thanks

afk

1 ACCEPTED SOLUTION

Hi @vanessafvg , you're right. It looks like the date hierarchy is just adding in those extra years in the slicer even though the data doesn't actually exist.

 

When I filter for the incorrect years, it doesn't return any data.

View solution in original post

10 REPLIES 10
Anonymous
Not applicable

it's a very broad definition of the issue, but I would first check date formats. Are they coherent with your data source? Where are you getting data from?

They're set up with data type as "date", with the format dd/MM/yyyy.

 

Data is coming from a table in SQL server. But when I bring this data into Power BI, and it creates the date hierarchy, the Years don't correspond correctly to the date.

1901 is often a year used when the date value is unknown.   

 

what table are you bringing the year from, have you done a mix and max on that table?

 

 

i would do more digging in the data.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hi @vanessafvg , @Anonymous. The data comes out of SQL server as date and appears as below in Power BI,

Date.JPG

The hierarchy is created as this:

Date hierarchy.JPG

But when I filter for year, it shows the following:

year filter.JPG

Anonymous
Not applicable

Well, in a case like this I would FIRST look at the original dataset. Does it REALLY NOT contain any day from 1901 or 1902?
Does it contains integers which might be interpreted by PBI as dates?

 

With this poor information, I can't be of more help

Hi @Anonymous , @vanessafvg 

 

The original dataset does contain 1901, but that is the only valid "incorrect" year. The other years are 2019 and 2020.

 

In SQL server the field has data type date with the following format

 

sql data type.JPG

sql date.JPG

 

Additionally, if I create a year column based on this date, it returns the correct years.

pbi year.JPG

pbi year filter.JPG

It is the date hierarchy which seems to return incorrect years

@bo_afk  i would think the date hiearchy which i believe is actually a virtual table will probably pad the gaps between the  dates, if you want more control over the date, create your own date table and your own hiearchy from the date table, i think that might give you more control

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hi @vanessafvg , you're right. It looks like the date hierarchy is just adding in those extra years in the slicer even though the data doesn't actually exist.

 

When I filter for the incorrect years, it doesn't return any data.

Anonymous
Not applicable

@vanessafvg  is correct BUT if you create a date table it MUST have continous dates. 

@bo_afk  any chance you can share your date table?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.