Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
5 years ago
Solved

Filas divididas mongodb

Hola a todos, Tengo una colección en mongoDB que es algo como esto:   No conseguimos encontrar tu ubicación exacta. (No puse todos los campos que el objeto de parcela tiene en este ejemplo...
  • Syndicate_Admin's avatar
    5 years ago

    No hay @Postigo,

    Creo que lo entiendo.

    ¿Esto logra lo que quieres?

    let
      Source = Csv.Document(
        File.Contents("D:\Downloads\PowerBiFile\billingletters3.csv"), 
        [Delimiter = ",", Columns = 32, Encoding = 1252, QuoteStyle = QuoteStyle.Csv]
      ), 
      #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars = true]), 
      #"Changed Type" = Table.TransformColumnTypes(
        #"Promoted Headers", 
        {
          {"__v", Int64.Type}, 
          {"_id", type text}, 
          {"active", type logical}, 
          {"billingContacts", type text}, 
          {"changed", type datetime}, 
          {"closed", type logical}, 
          {"company._id", type text}, 
          {"company.cnpj", type text}, 
          {"company.name", type text}, 
          {"companyGroup._id", type text}, 
          {"companyGroup.name", type text}, 
          {"contacts", type text}, 
          {"cost.costCenter", Int64.Type}, 
          {"cost.executionUnity", Int64.Type}, 
          {"cost.natureType", type text}, 
          {"cost.observation", type text}, 
          {"cost.sellingValue", Int64.Type}, 
          {"cost.valueClass", Int64.Type}, 
          {"created", type datetime}, 
          {"info.costCenter", Int64.Type}, 
          {"info.executionUnity", Int64.Type}, 
          {"info.observation", type text}, 
          {"info.valueClass", Int64.Type}, 
          {"name", type text}, 
          {"owner._id", type text}, 
          {"owner.name", type text}, 
          {"parcels", type text}, 
          {"parcelsNumber", Int64.Type}, 
          {"products", type text}, 
          {"project", type text}, 
          {"projects", type text}, 
          {"refunds", type text}
        }
      ), 
      #"Parsed JSON" = Table.TransformColumns(#"Changed Type", {{"parcels", Json.Document}}), 
      #"Expanded parcels" = Table.ExpandListColumn(#"Parsed JSON", "parcels")
    in
      #"Expanded parcels"

    (deberá cambiar la ruta de acceso del archivo hacia atrás)

    Espero que esto ayude.