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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

date format doesn't work in if function

Hi,

 

I've tried the following if statement in a calculated measure:

TestDate = if(1=1,now(),0)

 

But instead of a date I am getting this output when I put the measure into a Card:

42K

 

I've tried changing the format to "Date" but that option is ghosted out. Please do you know how to fix?

 

Thanks,

 

CM

1 ACCEPTED SOLUTION

Because the value-if-false is not a date. If you replace that with a date value, then you'll be fine.

 

Example: TestDate = if(1=1,now(),DATE(2017,1,1))

Specializing in Power Query Formula Language (M)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

the full output with 15 decimal places is:

42.833606497689999 K

 

so I think this is a datetimestmp (with 42833 being the 8th April 2017). And the remaining decimal places being the time. But why does Power BI refuse to display this as a date/time?

Because the value-if-false is not a date. If you replace that with a date value, then you'll be fine.

 

Example: TestDate = if(1=1,now(),DATE(2017,1,1))

Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

Thank you Marcel 🙂

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.