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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
VeronikaStolfa
Frequent Visitor

Current date - Extract (Day From Current_date) + 1

Hello all,

 

could you please help me with the issue below? 

 

I need to add column:

where is actual date - give me date in current month but with first day of month.

 

For example today is 2022-07-28 and I need to get 2022-07-01. I need to set it up as dynamic report. It means when somebody downloand report on 2022-09-15, I will need to get 2022-09-01. 

 

We could use this condition in SQL language: 

date_of_day IN (Current_Date - Extract (DAY From Current_Date) + 1)

 

Thank you in advance!

2 ACCEPTED SOLUTIONS
JamesRobson
Resolver II
Resolver II

Hi,

 

This might do it

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
#"Calculated Start of Month" = Table.TransformColumns(#"Changed Type",{{"Date", Date.StartOfMonth, type date}})
in
#"Calculated Start of Month"

 

JamesRobson_0-1659024405221.png

 

 

Thanks,

 

PS just realised you said add a column so just duplicate your current date column first 🙂

View solution in original post

v-kkf-msft
Community Support
Community Support

Hi @VeronikaStolfa ,

 

Please open a blank query and paste the code.

 

let
    Source = Date.StartOfMonth( DateTime.LocalNow() )
in
    Source

vkkfmsft_0-1659404390441.png

 

And you can also create a measure to get date.

 

Measure = EOMONTH( TODAY(), -1) + 1

vkkfmsft_1-1659404687392.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @VeronikaStolfa ,

 

Please open a blank query and paste the code.

 

let
    Source = Date.StartOfMonth( DateTime.LocalNow() )
in
    Source

vkkfmsft_0-1659404390441.png

 

And you can also create a measure to get date.

 

Measure = EOMONTH( TODAY(), -1) + 1

vkkfmsft_1-1659404687392.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

JamesRobson
Resolver II
Resolver II

Hi,

 

This might do it

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
#"Calculated Start of Month" = Table.TransformColumns(#"Changed Type",{{"Date", Date.StartOfMonth, type date}})
in
#"Calculated Start of Month"

 

JamesRobson_0-1659024405221.png

 

 

Thanks,

 

PS just realised you said add a column so just duplicate your current date column first 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors