Forum Discussion

third_hicana's avatar
third_hicana
Helper IV
3 years ago
Solved

Creating a summary table without importing another source.

Hi. I want to achieve this kind of visualisation. However. I don't know how to create a query that will be able to count the number of permanent, contractor, and vacancy per month. I just want to cre...
  • BeaBF's avatar
    BeaBF
    3 years ago

    third_hicana  no sorry, with first one I refered to the first code i gave you about the new table.

    Create the Table Type with this code:

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7PKylKTC7JL1LSUTJWitWJVgpILcpNzEvNK4GLhCUmJ+YlV0L4sQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Type = _t, DUMMY = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Type", type text}})
    in
    #"Changed Type"

    then a new table with:

    let
    Source = Table,
    #"Added Custom1" = Table.AddColumn(Source, "DUMMY", each "3"),
    #"Merged Queries" = Table.NestedJoin(#"Added Custom1", {"DUMMY"}, Type, {"DUMMY"}, "Type", JoinKind.LeftOuter),
    #"Expanded Type" = Table.ExpandTableColumn(#"Merged Queries", "Type", {"Type"}, {"Type.1"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Type", "Count", each if [Contract Type] = [Type.1] then 1 else 0),
    #"Grouped Rows" = Table.Group(#"Added Custom", {"Start Date", "Type.1"}, {{"Count", each List.Sum([Count]), type number}})
    in
    #"Grouped Rows"

     

    BBF