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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
shakirkhanani
Helper I
Helper I

How to convert SQL syntax to Dax

Is it possible to convert following command into Dax, in order to convert Georgian date into Hijri:

With respect to SQL Server 2012:

SQL Serverer 2012 introduces a new Format function that used to achieve the same result.

SELECT FORMAT ( GETDATE(), 'dd/MM/yyyy', 'ar-SA' )

Output

16/08/1435

 

Ref: https://blog.devoworx.net/2014/06/14/how-to-convert-gregorian-dates-to-hijri-date-in-sql-server-2008...

 

Thanks in advance.

 

Regards,

M Shakir

1 ACCEPTED SOLUTION

HI @v-xjiin-msft,

 

Thank you for taking part in my small request.  

 

I will definitely share under IDEA.

 

My work around was simillar as suggested by yourself and other participant.  Under excel, in one column I entered dates, convered them in Hijri and format them as Text, and connected this table to my Power BI Desktop, and relate them with the Date table. 

Capture.PNG

Capture.PNG
This help me get the desired results.

View solution in original post

11 REPLIES 11
v-xjiin-msft
Solution Sage
Solution Sage

Hi @shakirkhanani,

 

As I know, currently we are using Georgian date format in Power BI Desktop no matter which region you are in. And it is unable to convert Georgian date into Hijri date within DAX. For the Hijri date format in Power BI, I would suggest you to submit an Idea here for a feature request.

 

Then in your scenario, if you still want to convert the date I would suggest you to do the work at SQL Server side and import the data into Power BI. But please be noticed that after converting, it is a text type value and is no longer a date type value.

 

Thanks,
Xi Jin.

 

 

HI @v-xjiin-msft,

 

Thank you for taking part in my small request.  

 

I will definitely share under IDEA.

 

My work around was simillar as suggested by yourself and other participant.  Under excel, in one column I entered dates, convered them in Hijri and format them as Text, and connected this table to my Power BI Desktop, and relate them with the Date table. 

Capture.PNG

Capture.PNG
This help me get the desired results.

Hi @shakirkhanani,

 

Thanks for shareing us your solution. Please kindly mark it as answer. It will benefit others with the relevant issue. Smiley Happy

 

Thanks,
Xi Jin.

Anonymous
Not applicable

Hi @shakirkhanani,

 

Try  FORMAT(Table[Date],"DD/MM/YYYY")

 

Hope this works.

I'm guessing the column isn't set to Data Type: Date

Thanks for the suggestion.  Unfortunately it didnt work.

Is the date column formatted as a date in the Modeling tab on the Ribbon?  You can also format Dates using Power BI's built in format on the ribbon there too.

image.png

 

 

Anonymous
Not applicable

Could you try replace in Edit Query (screenshot attached), and see if it works? 

 

Date format.PNG

 

 

 

It doesnt. But thanks for chipping in.  Basically I wanted to convert the Georgian date into Hijri (solar calendar).  I tried under Change Tyepe -> Locale as well:

Capture.PNG

However, the column still shows Georgina date and not as above, please see below:

Capture.PNG

I see, it doesn't appear that Power BI supports that from anything I can find.  You may have to treat it as text and convert/format it manually.

Yes... it appears so.  very unfortunate..  But big thumbs to all, who shared their suggestions.  Thank you guys.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.