Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I have a Table with Missing values on weekends and holidays,
I need to populate missing values with the weekly average.
I have used Simple Formula
but the average is for the whole period, not the row week I need. I have a similar dataset written down.
date | Weekday | week num | Values (KPMR) |
10/11/2020 | 7 | 42 | |
10/12/2020 | 1 | 42 | 11 |
10/13/2020 | 2 | 42 | 84 |
10/14/2020 | 3 | 42 | 42 |
10/15/2020 | 4 | 42 | 95 |
10/16/2020 | 5 | 42 | 42 |
10/17/2020 | 6 | 42 | |
10/18/2020 | 7 | 43 | |
10/19/2020 | 1 | 43 | 18 |
10/20/2020 | 2 | 43 | 24 |
10/21/2020 | 3 | 43 | 17 |
10/22/2020 | 4 | 43 | 47 |
10/23/2020 | 5 | 43 | 82 |
10/24/2020 | 6 | 43 | |
10/25/2020 | 7 | 44 |
how can I Populate missing values based on the weekly average or monthly average?
I have multiple rows per day (let's say transactions), but the Value (KPMR) will be the same.
@bazari , you might want to achieve your goal in Power Query,
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc9BDoUgDIThq7ywNpEORfAsxvtfQ9BMzcS3oJuPJv2PI1lezVZk5LSkNp5jjF86l8dAM5pZYCGC2D3QiYU4BrESnbjXwI1Y/2w24vY9tktIEdslZJp1IrKETESEwCTk3myBkJD7x4tFQib2CIFLiByLKiH+2HkB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [date = _t, Weekday = _t, #"week num" = _t, #"Values (KPMR)" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"Weekday", Int64.Type}, {"week num", Int64.Type}, {"Values (KPMR)", Int64.Type}}),
#"Grouped Rows" = Table.RemoveColumns(Table.Group(#"Changed Type", {"week num"}, {{"ar", each _, type table [date=nullable date, Weekday=nullable number, week num=nullable number, #"Values (KPMR)"=nullable number]}}), {"week num"}),
Population = Table.TransformColumns(
#"Grouped Rows",
{"ar",
each let kpmr = [#"Values (KPMR)"], avg = List.Sum(kpmr)/List.NonNullCount(kpmr) in Table.ReplaceValue(
_, null, avg, Replacer.ReplaceValue, {"Values (KPMR)"}
)}
),
#"Expanded ar" = Table.ExpandTableColumn(Population, "ar", {"date", "Weekday", "week num", "Values (KPMR)"}, {"date", "Weekday", "week num", "Values (KPMR)"})
in
#"Expanded ar"
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
So, no Simple DAX can resolve that? that's the quite complicated solution. I Have to apply that on 3 million rows, so i think it will be quite slow.?
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |