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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JarekM
Regular Visitor

Overlay Two Tabel

Hi, I am New

maybe someone can help me here

I need to overlaay two tabel 

 

I tried to group but got stuck, how to do this using : 

 #"Aantal samengevoegd" = Table.AggregateTableColumn(#"Rijen gegroepeerd", "Aantal", {{"1-1-2023", List.Buffer, "1-1-2023"}}),
#"Uitgepakte waarden" = Table.TransformColumns(#"Aantal samengevoegd", {"1-1-2023", each Text.Combine(List.Transform(_, Text.From), " "), type text})  with replacing dates for "each _"??

Thank You for Help! 

 

 

 

1 ACCEPTED SOLUTION

Hello - instead of looping through columns, I think it would be better to append the tables, unpivot, transform and repivot, like this:

let
    Source = Table.Combine({Table1, Table2}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name", "Place"}, "Attribute", "Value"),
    #"Replaced Value" = Table.ReplaceValue(#"Unpivoted Other Columns","",null,Replacer.ReplaceValue,{"Value"}),
    #"Grouped Rows" = Table.Group(#"Replaced Value", {"Name", "Place", "Attribute"}, {{"Data", each _, type table [Name=nullable text, Place=nullable text, Attribute=text, Value=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each if List.NonNullCount ( [Data][Value] ) > 1 then Text.Combine ( List.Sort ( [Data] [Value] ), " - " ) else List.RemoveNulls ( [Data][Value] ){0} ),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Attribute]), "Attribute", "Custom")
in
    #"Pivoted Column"

Result

jennratten_0-1679396764615.png

 

View solution in original post

4 REPLIES 4
jennratten
Super User
Super User

Hello - below is how you can add a new column that checks whether or not the value is a date.  If you can post a sample of your data and show what your expected result is I can help further.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMDJWitWJVkrKKU0FM4BiCNH0otTUPKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each try Value.Is ( Date.From ( [Column1] ), type date ) otherwise false)
in
    #"Added Custom"

 

jennratten_0-1679390823011.png

 

 

JarekM_0-1679394650067.png

 

 

I do not want to do this same step 365 times, it is not going about to chacke if is date or not, I want to use List with colums.... something like this....

 

#"Aantal samengevoegd" = Table.AggregateTableColumn(#"Rijen gegroepeerd", "Aantal", {{"1-1-2023", List.Buffer, "Totaal van 1-1-2023"}, {"2-1-2023", List.Buffer, "Totaal van 2-1-2023"}}),

I need something like Table.AggregateTableColumn(#"Rijen gegroepeerd", "Aantal", each _ Column in ColumnList, List.Buffer, Column Name)

#"Uitgepakte waarden" = Table.TransformColumns(#"Aantal samengevoegd", {"Totaal van 1-1-2023", each Text.Combine(List.Transform(_, Text.From), " "), type text}),
#"Uitgepakte waarden1" = Table.TransformColumns(#"Uitgepakte waarden", {"Totaal van 2-1-2023", each Text.Combine(List.Transform(_, Text.From), " "), type text})

This one i need to do one time and not 365 times....

#"Uitgepakte waarden1" = Table.TransformColumns(#"Uitgepakte waarden", {each column, each Text.Combine(List.Transform(_, Text.From), " "), type text})

 

I'm not sure I do it good

Hello - instead of looping through columns, I think it would be better to append the tables, unpivot, transform and repivot, like this:

let
    Source = Table.Combine({Table1, Table2}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name", "Place"}, "Attribute", "Value"),
    #"Replaced Value" = Table.ReplaceValue(#"Unpivoted Other Columns","",null,Replacer.ReplaceValue,{"Value"}),
    #"Grouped Rows" = Table.Group(#"Replaced Value", {"Name", "Place", "Attribute"}, {{"Data", each _, type table [Name=nullable text, Place=nullable text, Attribute=text, Value=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each if List.NonNullCount ( [Data][Value] ) > 1 then Text.Combine ( List.Sort ( [Data] [Value] ), " - " ) else List.RemoveNulls ( [Data][Value] ){0} ),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Attribute]), "Attribute", "Custom")
in
    #"Pivoted Column"

Result

jennratten_0-1679396764615.png

 

thank you for your help, it works perfectly😁

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors