Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello, I need help in transforming my data into months with the values in average similar to below. I need this done in power query. Basically, the date will be grouped to per month only and the rate will then be averaged.
Solved! Go to Solution.
Hi! @Anonymous
You can open power query editor and use the group by feature in Home tab and then choose these options
and you should see your results -
you can use this m-code for reference -
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], /*change the source to point out to your source*/
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type datetime}, {"Rate", Int64.Type}}),
#"Added Custom Column" = Table.AddColumn(#"Changed Type", "Date1", each Text.Combine({DateTime.ToText([Date], "MMM"), "-", DateTime.ToText([Date], "yyyy")}), type text),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom Column",{{"Date1", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type1", {"Date1"}, {{"Month", each List.Average([Rate]), type nullable number}})
in
#"Grouped Rows"
Hi! @Anonymous
You can open power query editor and use the group by feature in Home tab and then choose these options
and you should see your results -
you can use this m-code for reference -
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], /*change the source to point out to your source*/
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type datetime}, {"Rate", Int64.Type}}),
#"Added Custom Column" = Table.AddColumn(#"Changed Type", "Date1", each Text.Combine({DateTime.ToText([Date], "MMM"), "-", DateTime.ToText([Date], "yyyy")}), type text),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom Column",{{"Date1", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type1", {"Date1"}, {{"Month", each List.Average([Rate]), type nullable number}})
in
#"Grouped Rows"
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
39 | |
37 | |
32 | |
25 | |
24 |
User | Count |
---|---|
37 | |
29 | |
23 | |
21 | |
17 |