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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PBINewby
Frequent Visitor

Implement a base62 decoding in a Dataflow Parameter Query

Hi,

I have the VBA code for a base62 decoding and want to use that function in a dataflow to convert IDs. Does anyone know how to implement that function in a parameter query?

 

Function Base62Encode(ByVal num As Variant) As String

Dim base62_chars As String
base62_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Dim base62 As String
base62 = ""
Do While num > 0
base62 = Mid(base62_chars, (num - Int(num / 62) * 62) + 1, 1) & base62
num = Int(num / 62)
Loop
Base62Encode = base62

End Function

 

Thanks for any help!

1 ACCEPTED SOLUTION
PBINewby
Frequent Visitor

found a solution 😁:   

let
    // Base62 character set
    base62Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",

 

    // Function to convert a number to Base62
    NumberToBase62 = (num as number) as text =>
    let
        base = 62,
        Convert = (n, acc) =>
            if n = 0 then
                acc
            else
                @Convert(Number.IntegerDivide(n, base), Text.Middle(base62Chars, Number.Mod(n, base), 1) & acc)
    in
        if num = 0 then
            "0"
        else
            Convert(num, "")
in
    NumberToBase62

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @PBINewby ,

Thanks a lot to hear that you got the solution and that you shared your answer and can mark him as solution!

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PBINewby
Frequent Visitor

found a solution 😁:   

let
    // Base62 character set
    base62Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",

 

    // Function to convert a number to Base62
    NumberToBase62 = (num as number) as text =>
    let
        base = 62,
        Convert = (n, acc) =>
            if n = 0 then
                acc
            else
                @Convert(Number.IntegerDivide(n, base), Text.Middle(base62Chars, Number.Mod(n, base), 1) & acc)
    in
        if num = 0 then
            "0"
        else
            Convert(num, "")
in
    NumberToBase62

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.