Forum Discussion

Lucian's avatar
Lucian
Icon for Responsive Resident rankResponsive Resident
6 years ago
Solved

Get proper type from PowerQuery function

Hello, I need some help getting proper type inside a PowerQuery function. To get some data from a Navision table, I have created a function:   (strCompanyName as text) as table => let Source...
  • Anonymous's avatar
    Anonymous
    6 years ago

    HI Lucian,

    I test with a few M query functions but failed to nested change type parameter into expanding column function. It seems like you can only extract previous table schema and use it in the next change type steps.

    Custom function to extract the table column name and type structure that can be used in change type function:

     

    let
        RecognizeType=(tb as table) => List.Zip({ Table.Schema(tb)[Name],List.Transform(Table.Schema(tb)[Kind], each Expression.Evaluate("type "&_))})
    in
        RecognizeType

     

    Usage:

     

    #"Changed Type"= Table.TransformColumnTypes(#"previous steps",RecognizeType('table'))

     

    Notice:

    1. please do mask with shared sensitive data.

    Regards,

    Xiaoxin Sheng

  • Anonymous's avatar
    Anonymous
    6 years ago

    HI Lucian,

    This issue may be caused by force invoke external or previous steps datasource to calculate in the current step. They may affect the satable of calculation and cause the conflict or compatibility issues when calculate out of the current step and contents.

    You can take a look at the following blog to know more about this issue:

    Data Privacy and the Formula Firewall in Power BI / Power Query 

    Regards,

    Xiaoxin Sheng