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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Cocrodile
Helper I
Helper I

Date blank

Hello
I have this table :

Cocrodile_0-1648129909157.png

 

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 

 

1 ACCEPTED SOLUTION
Cocrodile
Helper I
Helper I

The solution in power query  is : 

if [date out]=null then Date.EndOfWeek ([date in ],Day.Sunday) else [date out])

🤣

View solution in original post

5 REPLIES 5
Cocrodile
Helper I
Helper I

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



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




we in europe consider the weekend to be Sunday ..
however, I laughed because the solution was very easy

serpiva64
Solution Sage
Solution Sage

Hi,

You can try:

- add a custom column to your date table

serpiva64_0-1648133514647.png

- then a calculated column 

date out noblank = if(ISBLANK('Table (2)'[data out]),format(RELATED(Dates[WeekEndingSunday]),"dd/mm/yyyy"),FORMAT('Table (2)'[data out],"dd/mm/yyyy"))

serpiva64_1-1648133578880.png

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 !

 

 

BA_Pete
Super User
Super User

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:

BA_Pete_0-1648132833653.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors