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
sumitmishra05
Frequent Visitor

Losing Date Hierarchy with DirectQuery but with import it works

Hi,

In one of the exercise I was connected to the MS SQL Server DB using DirectQuery. One of the column named "TransactionDate", although set as DateTime data type in the source table and Date data type in PowerBI model, was not showing Hierarchy.

 

DirectQueryDate.jpg

In other question it has been highlighted that this happens due to the mapping to other tables on the date column, so I checked that as well:

DirectQueryData Model.jpg

As soon as I changed the connection to import it started showing the Hierarchy:

Date Hierarchy.jpg

 

I am looking for for the possible reason for this beahvior and a solution from this wonderful community.

 

Thanks.

Sumit

2 REPLIES 2
parry2k
Super User
Super User

@sumitmishra05 basically when you import, by default a hidden calendar table gets created in the model to give you the hierarchy, and as a best practice, you don't want this instead you want to create a separate date dimension in the model to use in any time intelligence use case. 

 

Keep in mind, each date table in the model will have its own hidden date dimension table and it can increase the size of your model drastically, so as a recommendation, turn off auto date/time under options and bring your own date dimension whether you are using import or direct query method. And in this date dimension, you can create your own hierarchy and use it in the visualization. I have a blog post that talks about how to create a date table, although there are tons of resources and material available online.

 

Good luck. Always follow best practice to create a scalable and fast performing data model, it is the key for any Power BI project, and all the visualization and everything becomes super simple once you have a rock-solid mode and date dimension is one of the key tables in the model and every model must have one.

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.