Forum Discussion
Change month name language
- 9 years ago
Two ways
1. Go to file > options and settings > options > regional setting > select spanish
Save and close it . Then open
if it will not help u . U have to create one calculated column to replace the old column with same name.
Column = var Month_Name = FORMAT( 'date_field'[fecha]; "mm" )
return switch ( true(),
Month_Name=1, "Jan in Spanish"
.
.
.
etc
)
Two ways
1. Go to file > options and settings > options > regional setting > select spanish
Save and close it . Then open
if it will not help u . U have to create one calculated column to replace the old column with same name.
Column = var Month_Name = FORMAT( 'date_field'[fecha]; "mm" )
return switch ( true(),
Month_Name=1, "Jan in Spanish"
.
.
.
etc
)
Hi Baskar.
Just wanted to correct on your code example and give some variations to people.
In Power BI using comma as shown in example gives you an error, use semicolon ("Date" is the date column aka FulldateAlternateKey):
Normal Switch statement in-line
SpanishMonth = SWITCH(MONTH([Date]); 1; "Enero"; 2; "Febrero"; 3; "Marzo"; 4; "Abril"
; 5; "Mayo"; 6; "Junio"; 7; "Julio"; 8; "Agosto"
; 9; "Septiembre"; 10; "Octubre"; 11; "Noviembre"; 12; "Diciembre"
; "Unknown month number" )
Other examples passing string or integer with variable, note that an error will be flagged If you don't use the same data type in the switch comparison:
Switch on String Value
SpanishMonth2= var Month_Name = FORMAT([Date]; "m")
//"mm" returns "01", "02" etc. which will not compare to string value "1", "2" etc.
return switch ( true();
Month_Name="1"; "Enero";
Month_Name="2"; "Febrero")
Switch on Integer Value
SpanishMonth3 = var Month_Name = MONTH([Date]) //MONTH returns Integer.
return switch ( true();
Month_Name=1; "Enero";
Month_Name=2; "Febrero")
- CJDK5 years ago
Helper II
For combined month and year column, I used Anonymous method (thanks!) as follows:
- Created RussianMonth column as above.
- Created Year column from Date column.
- Created Russian month and year column:
RUS_Month_Year = COMBINEVALUES(" ", [RussianMonth], [Year])