In this blog post we will learn how to change the language of the hierarchical date values in Power BI to display Arabic months.
The first solution is to change the Locale to Arabic
- Open Power BI Desktop.
- Go to the File menu in the top-left corner.
- Select Options and settings and then Options.
- In the Options window, under the Regional Settings section, look for Locale.
- From the Locale dropdown menu, select Arabic. You can choose a specific Arabic locale, such as Arabic (Saudi Arabia), Arabic (Egypt), or others, depending on your preference.
Create a Date Table with the Calendar Function
First, create a basic calendar table using the CALENDAR
function:
CalendarTable = CALENDAR(DATE(2020, 1, 1), TODAY())
This generates a date table from January 1, 2020, to today’s date.
Step 2: Add Arabic Month Names to Power BI
Next, you’ll need to add a calculated column for the Arabic month names. You can use a SWITCH
or IF
statement to map the month numbers to their corresponding Arabic names.
Here’s how to do it:
- Click on your CalendarTable.
- Go to the Modeling tab and click New Column.
- In the formula bar, enter the following DAX code to create a column for Arabic month names:
ArabicMonth =
SWITCH(
TRUE(),
MONTH(CalendarTable[Date]) = 1, "يناير",
MONTH(CalendarTable[Date]) = 2, "فبراير",
MONTH(CalendarTable[Date]) = 3, "مارس",
MONTH(CalendarTable[Date]) = 4, "أبريل",
MONTH(CalendarTable[Date]) = 5, "مايو",
MONTH(CalendarTable[Date]) = 6, "يونيو",
MONTH(CalendarTable[Date]) = 7, "يوليو",
MONTH(CalendarTable[Date]) = 8, "أغسطس",
MONTH(CalendarTable[Date]) = 9, "سبتمبر",
MONTH(CalendarTable[Date]) = 10, "أكتوبر",
MONTH(CalendarTable[Date]) = 11, "نوفمبر",
MONTH(CalendarTable[Date]) = 12, "ديسمبر"
)
You can create Full date if you need by using this formula
FullDate =
FORMAT(CalendarTable[Date], "dd") & " " & CalendarTable[ArabicMonth] & " " & FORMAT(CalendarTable[Date], "yyyy")
power bi create date hierarchy manually
To create date hierarchy manually, we have to add Columns for Year, Month, Day, and Arabic Month Name:
First, add the Year, Month, and Day columns to your calendar table.
Go to Modeling > New Column and use the following DAX code:
Year = YEAR(CalendarTable[Date])
Month Column (Numeric):
Month = MONTH(CalendarTable[Date])
Day Column:
Day = DAY(CalendarTable[Date])
and the Arabic month we created before.
Create a Date Hierarchy
Now that you have the required columns, you can create a hierarchy:
- In the Fields pane, select your Full date, right click and choose to create hierarchy
- Add the columns Year, ArabicMonth, and Day to the hierarchy in the following order:
- Year at the top level.
- ArabicMonth at the second level.
- Day at the third level.
Right click on the field and choose add to hierarchy.
You will now have a hierarchy with Year → Arabic Month → Day
This is how Power BI create date hierarchy manually (Arabic).
You can use this Date in your visual in Power BI.
Sort the ArabicMonth Column by the MonthNumber Column
- Go to the “Fields” pane and click on the ArabicMonth column.
- In the Column Tool tab, click on the Sort by Column button.
- Select the MonthNumber column to sort the Arabic months based on the month numbers.
- The MonthNumber column gives the Arabic months a numeric order, which Power BI uses for sorting.
- The Sort by Column feature in Power BI ensures that the Arabic months are ordered by the MonthNumber instead of alphabetical order.
This should solve the issue of Arabic months not appearing in the correct order in your slicer.
So in this blog we covered how Power BI create date hierarchy manually in Arabic and how to sort the Arabic months based on the month number.
See Also
- How To Use Pdf Function In PowerApps?
- Working With PowerApps Nested Gallery Control
- How Power Automate Create Excel Table Dynamically? | Power Automate
- How To Make A Csv File Utf-8 Encoded? | Power Automate
- How To Format Text In PowerApps? PowerApps Convert Text To Other Data Types
- Alternate Row Color In Gallery PowerApps: Simplest Way
- Check If PowerApps Contains Substring
- PowerApps If Statement And Nested If With Example
- Model Driven App With SharePoint Data Source
- PowerApps Get Day Of Week Date
Join us
- Subscribe Power Platform Geeks.