Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bselby
Frequent Visitor

Date Hierarchy and Date Tables via Direct Query (SAP HANA)

Hi,

 

I'm having an issue getting the Date Hierarchy to appear on date fields retrieved via Direct Query mode for the SAP HANA database connection (treated as relational source).

 

If I create the connection in "Import" mode, it recognises the date hierarchy fine:

 

Hierarchy Import.JPG

 

 If I create the connection in "Direct Query" mode, it doesn't create the hierarchy (even if it is enabled in settings):

 

Hierarchy Direct Query.JPG

 

I can add my own date table via "new table" and CALENDAR function as suggested in previous threads, and join to my query table, and that seems ok:

 

Date Table.JPG

Tables.JPG

 

 And the storage mode changes to mixed:

 

Storage Mode.JPG

 

However, once I have added this table, whenever I try to edit the stored query in future, it always wants to convert it to Import mode - the Direct Query mode is disabled (this doesn't happen without the date table):

 

Query Edit.JPG

 

This means when I make a change, the file becomes irreversably import-based.

 

What is the best way forward here? I don't really want to "lock" my file to the first version of the query saved, because there will always be further changes to make, but I can't seem to enter a date table otherwise.

 

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @bselby

 

The built-in date hierarchy is not available when using DirectQuery mode.I would suggest you create the Year,Quarter,Month,Day columns manually.Then you may right-click the Date column and choose 'New Hierarchy'.Then click the Year,Quarter,Month,Day columns and add them to this new hierarchy manually.

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Cherie,

 

Thank you for your response.

 

The problem is that I need the date table joined in order to keep the custom sort order on my line chart (if there is no data in the filtered visualisation for a specific month or months, it doesn't sort correctly as per my other thread).

 

However, I've since found that I can actually keep the dashboard as Mixed Storage depending on where I adjust the query. In the example picture below, if I adjust the query in the red box, the whole dashboard irreversably changes to Import as I originally stated. But, if I change it in the DAX formula box, it will correctly adjust the query and keep it as Direct Query! As such, the entire document stays as Mixed Storage mode.

 

Query Edit 2.JPG

 

This has worked well for me, as I have been able to adjust my query several times without losing the Direct Query mode, and keep my date table intact. The only tedious part is changing the query into the DAX format, but I've found that if I just quickly copy the file, paste my amended query into the red box, let it convert it to the DAX format itself and then copy that into the DAX section on my main document, it saves a lot of time.

 

If you know of a solution or upcoming fix that would allow me to make changes in the red box without it converting to Import mode, please let me know. Thank you!

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.