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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
al1981
Helper I
Helper I

between date - custom row wiht data type issue

I have Date table with Date column with Date format. Issue i have is that i cannot use this Date column in bellows custom formula (Expression.Error: We cannot apply operator < to types Number and Date)

What i did is duplicating column and format it into the "yyyymmdd" format as number... as those are additional steps and columns, i would like to avoid if possible... Is there a way?

 

if [Merged] >= 20231001 and [Merged] < 20240401 then "C1_23_24" else if [Merged] >= 20240401 and [Merged] < 20241001 then "C2_23_24" else "no cycle"

 

 

I wanted to do also this bellow but have same issue (Expression.Error: We cannot apply operator < to types Number and Date.). What would be best and most affective workarround?

 

let

ST = [Date],
Date1 = 01/10/2023,
Date2 = 01/04/2024,
Date3 = 01/10/2024,

Result =
if ST >= Date1 or ST < Date2 then "C1_23_24"
else
if ST>= Date2 or ST < Date3 then "C2_23_24"
else "no cycle"

in
Result

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Date1 = 01/10/2023 - This doesn't create a date.  Use #date()

https://learn.microsoft.com/en-us/powerquery-m/sharpdate 

View solution in original post

3 REPLIES 3
al1981
Helper I
Helper I

eeeeee 😉 missing [Date star] again 🙂 All ok!

thx!

al1981
Helper I
Helper I

hi @HotChilli 

 

can you please... tell me what i am missing for custom column? It`s driving me crazy .-)

 

if [Date start] > #date(2022, 9, 30) and < #date(2023, 4, 1) then "C1_22_23"
else
if [Date start] > #date(2023, 3, 31) and < #date(2023, 10, 1) then "C2_22_23"
else
if [Date start] > #date(2023, 9, 30) and < #date(2024, 4, 1) then "C1_23_24"
else
if [Date start] > #date(2024, 3, 31) and < #date(2024, 10, 1) then "C2_23_24"
else null

 

 

al1981_0-1722954320661.png

 

HotChilli
Super User
Super User

Date1 = 01/10/2023 - This doesn't create a date.  Use #date()

https://learn.microsoft.com/en-us/powerquery-m/sharpdate 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

August Carousel

Fabric Community Update - August 2024

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