Forum Discussion

Analitika's avatar
Analitika
Icon for Post Prodigy rankPost Prodigy
4 years ago
Solved

Two tables two different dates in Power BI

Hi,

 

I would like to ask how to resolve this issue. I have main table with date column DID_DAT and second table where date present in column headers like this:

Date filter is now implement by Date table.

How make that I will able to select data according to second table?

I tried to merge but got many duplicates.

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Analitika ,

     

    You could unpivot the columns with date name headers to get a date column.

    For example, you can select the ID column and then click 'Unpivot Other Columns'.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIEYmMgNlWK1YlWcgKyjIDYBIjNlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"2022-8-7" = _t, #"2022-8-8" = _t, #"2022-8-9" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", type text}, {"2022-8-7", Int64.Type}, {"2022-8-8", Int64.Type}, {"2022-8-9", Int64.Type}}),
        #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ID"}, "Attribute", "Value")
    in
        #"Unpivoted Other Columns"

     

     

    Best Regards,

    Stephen Tao

     

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

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Analitika ,

     

    You could unpivot the columns with date name headers to get a date column.

    For example, you can select the ID column and then click 'Unpivot Other Columns'.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIEYmMgNlWK1YlWcgKyjIDYBIjNlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"2022-8-7" = _t, #"2022-8-8" = _t, #"2022-8-9" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", type text}, {"2022-8-7", Int64.Type}, {"2022-8-8", Int64.Type}, {"2022-8-9", Int64.Type}}),
        #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ID"}, "Attribute", "Value")
    in
        #"Unpivoted Other Columns"

     

     

    Best Regards,

    Stephen Tao

     

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