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
LD1
Helper III
Helper III

Expression.error with the "RIGHT" formula

Hi everyone, 

 

I don't get why this error appears with the formula "RIGHT" (just below)

The syntaxe is validated but when i am in the result, i have this error message:

 

LD1_1-1657637858614.png

 

Formula: 

 

LD1_4-1657638317155.png

 

About the column concerned:

(First: year (2021) and next month (05) for example) 

 

LD1_5-1657638437857.png

 

In the cube all data is in text type.

 

Can you help me please? (Sorry in advance but i work with French application)

 

Thank you,

 

LD

 

 

 

 

2 ACCEPTED SOLUTIONS
jcalheir
Solution Supplier
Solution Supplier

Hi

 

Use the Text.End formula. Try this:

 

 

(...) "Numero mois", each Text.End([Mois Affichange], 2), type text)

 

 

If you for some reason have troble to find formulas, power query has the option "Column from examples" investigate that, it will help you when you are not so sure on which formula to use

 

jcalheir_0-1657640331563.png

 

Kind regards,
José
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

View solution in original post

PaulDBrown
Community Champion
Community Champion

If you want to extract the month values, use the option "extract" under transform in the ribbon:

2022-07-12.pngextract.pngextract 1.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjQwVYrVgTLNoExDSwNDBNMIwTRGME2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Mois = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Mois", Int64.Type}}),
    #"Extracted Last Characters" = Table.TransformColumns(#"Changed Type", {{"Mois", each Text.End(Text.From(_, "es-ES"), 2), type text}})
in
    #"Extracted Last Characters"

 

 

If you want to split into year and month, use the Split column option:

SPlit 0.pngsplit.png

split 1.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjQwVYrVgTLNoExDSwNDBNMIwTRGME2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Mois = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Mois", Int64.Type}}),
    #"Split Column by Position" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"Mois", type text}}, "es-ES"), "Mois", Splitter.SplitTextByPositions({0, 4}, false), {"Mois.1", "Mois.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"Mois.1", Int64.Type}, {"Mois.2", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Mois.1", "Année"}, {"Mois.2", "Mois"}})
in
    #"Renamed Columns"

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
PaulDBrown
Community Champion
Community Champion

If you want to extract the month values, use the option "extract" under transform in the ribbon:

2022-07-12.pngextract.pngextract 1.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjQwVYrVgTLNoExDSwNDBNMIwTRGME2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Mois = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Mois", Int64.Type}}),
    #"Extracted Last Characters" = Table.TransformColumns(#"Changed Type", {{"Mois", each Text.End(Text.From(_, "es-ES"), 2), type text}})
in
    #"Extracted Last Characters"

 

 

If you want to split into year and month, use the Split column option:

SPlit 0.pngsplit.png

split 1.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjQwVYrVgTLNoExDSwNDBNMIwTRGME2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Mois = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Mois", Int64.Type}}),
    #"Split Column by Position" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"Mois", type text}}, "es-ES"), "Mois", Splitter.SplitTextByPositions({0, 4}, false), {"Mois.1", "Mois.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"Mois.1", Int64.Type}, {"Mois.2", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Mois.1", "Année"}, {"Mois.2", "Mois"}})
in
    #"Renamed Columns"

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Wonderful !!

Thank you so much.

jcalheir
Solution Supplier
Solution Supplier

Hi

 

Use the Text.End formula. Try this:

 

 

(...) "Numero mois", each Text.End([Mois Affichange], 2), type text)

 

 

If you for some reason have troble to find formulas, power query has the option "Column from examples" investigate that, it will help you when you are not so sure on which formula to use

 

jcalheir_0-1657640331563.png

 

Kind regards,
José
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

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.