Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello
I have this table :
Can I ask you for a function that puts me where the empty values are on the last day of that week?
I would like to have the results of the 2 dates:
date in 22/03/2022 date out 27/03/2022
date in 16/03/2022 date out 20/03/2022
PS: I have the data for a whole year
Solved! Go to Solution.
The solution in power query is :
if [date out]=null then Date.EndOfWeek ([date in ],Day.Sunday) else [date out])
🤣
The solution in power query is :
if [date out]=null then Date.EndOfWeek ([date in ],Day.Sunday) else [date out])
🤣
Hi @Cocrodile ,
I'm not sure I get the joke here.
The code you've provided and marked as the solution doesn't actually give you the dates that you asked for. I think your code should be:
if [date out] = null then Date.EndOfWeek([date in], Day.Monday) else [date out]
Pete
Proud to be a Datanaut!
we in europe consider the weekend to be Sunday ..
however, I laughed because the solution was very easy
Hi,
You can try:
- add a custom column to your date table
- then a calculated column
If this post is useful to help you to solve your issue consider giving the post a thumbs up
and accepting it as a solution !
Hi @Cocrodile ,
You can use an edited replace step like this:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjLRNzDWNzIwMlLSUTIyg3NidYByRkhyYBFDZNWGliiqDc1QVMcCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"data in" = _t, #"data out" = _t]),
chgTypes = Table.TransformColumnTypes(Source,{{"data in", type date}, {"data out", type date}}),
repNulls = Table.ReplaceValue(chgTypes,null, each Date.EndOfWeek([data in], Day.Monday),Replacer.ReplaceValue,{"data out"})
in
repNulls
To get this:
Pete
Proud to be a Datanaut!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |