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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Analitika
Post Prodigy
Post Prodigy

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:

Analitika_0-1659526279389.png

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.

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

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'.

vstephenmsft_0-1659950227729.png

vstephenmsft_1-1659950262260.png

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.

 

View solution in original post

1 REPLY 1
v-stephen-msft
Community Support
Community Support

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'.

vstephenmsft_0-1659950227729.png

vstephenmsft_1-1659950262260.png

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.

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.