cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
SeckinYilmaz
Frequent Visitor

Create new monthly table from one value

My table as below.

Name Date         Value

A         1.1.2021    1

B         1.1.2021    2

A         1.1.2022   4

 

But I want to dublicate date and cover all months as I mentioned below.

Name Date         Value

A         1.1.2021    1

.

.

A         1.12.2021    1

B         1.1.2021      2

.

.

B         1.12.2021   2

A         1.1.2022    4

.

.

A         1.12.2022   4

 

Is there any way for it?

 

Thank you for your interest.

 

1 ACCEPTED SOLUTION
ChrisMendoza
Resident Rockstar
Resident Rockstar

@SeckinYilmaz - Easiest way I could think was using Power Query

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLUN9Q3MjAyBDGVYnWilZxQBY3AgkgqjYBME6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Date = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Date", type date}, {"Value", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Generated Months", each List.Transform({1 ..12}, each Number.From(_))),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Generated Months"),
    #"Added Custom1" = Table.AddColumn(#"Expanded Custom", "Created Month", each #date(Date.Year([Date]),[Generated Months],Date.Day([Date]))),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom1",{{"Created Month", type date}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Date", "Generated Months"})
in
    #"Removed Columns"





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

1 REPLY 1
ChrisMendoza
Resident Rockstar
Resident Rockstar

@SeckinYilmaz - Easiest way I could think was using Power Query

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLUN9Q3MjAyBDGVYnWilZxQBY3AgkgqjYBME6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Date = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Date", type date}, {"Value", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Generated Months", each List.Transform({1 ..12}, each Number.From(_))),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Generated Months"),
    #"Added Custom1" = Table.AddColumn(#"Expanded Custom", "Created Month", each #date(Date.Year([Date]),[Generated Months],Date.Day([Date]))),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom1",{{"Created Month", type date}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Date", "Generated Months"})
in
    #"Removed Columns"





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors