Reply
Syndicate_Admin
Administrator
Administrator
Syndicated - Inbound

BUG: Unable to convert value #date(2022, 9, 26) to type Number

Source Community: Power BI Spanish | Source Author Name: F4B

Good morning

I consult, I want to make dynamic this restriction in the Date field (this as Date / time)

each [FECHA] >=
#datetime(2022, 3, 1, 0, 0, 0))

each [FECHA] >=
#date(Date.AddDays(DateTime.Date(DateTime.LocalNow()), -30), 0, 0))

Porbe in this way but I the following error:

Expression.Error: Unable to convert the value #date(2022, 9, 26) to the Number type.
Details:
Value=26/9/2022
Type=[Type]

Thanks a lot.

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Syndicated - Outbound

If you don't need the time part of the [FECHA] column then you could convert it to a Date type before you execute this step. If you do need the time part you could use

each [FECHA] >=
DateTime.From(Date.AddDays(DateTime.Date(DateTime.LocalNow()), -30))

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

Syndicated - Outbound

If you don't need the time part of the [FECHA] column then you could convert it to a Date type before you execute this step. If you do need the time part you could use

each [FECHA] >=
DateTime.From(Date.AddDays(DateTime.Date(DateTime.LocalNow()), -30))

Source Community: Power BI Spanish | Source Author Name: F4B
Syndicated - Inbound

This option worked correctly.
Thanks a lot

johnt75
Super User
Super User

Syndicated - Outbound

Try

each [FECHA] >=
Date.AddDays(DateTime.Date(DateTime.LocalNow()), -30)

Source Community: Power BI Spanish | Source Author Name: F4B
Syndicated - Inbound

Try and give the following error:

Expression.Error: Unable to apply the < operator to the Date and DateTime types.
Details:
Operator=<
Left=26/9/2022
Right=1/1/2022 00:00:00

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)