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
Anonymous
Not applicable

problerms Datediff function

Hi Community,

Can someone tell me where the fault is?

 

000054.jpg

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

If you need measure to create [Status], then try codes below.

 

 

 

Status=

VAR _m=DATEDIFF(TODAY(), MAX('MB final'[Custom.1]),MONTH)

RETURN

SWITCH(TRUE(),

_m=0, "1.On Time",

_m>0&&_m<=3, "2.delayed 1-3 month",

_m>3&&_m<=6,"3.delayed 3-6 month",

"4.delayed >6 month"

)

 

 

 

If you need calculated column to create [Status], then try codes below.

 

 

 

Status=

VAR _m=DATEDIFF(TODAY(), 'MB final'[Custom.1],MONTH)

RETURN

SWITCH(TRUE(),

_m=0, "1.On Time",

_m>0&&_m<=3, "2.delayed 1-3 month",

_m>3&&_m<=6,"3.delayed 3-6 month",

"4.delayed >6 month"

)

 

 

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , if it a measure. Then you need to min or Max on the date from your table

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Internal and confidential content is permitted. Translate  unfortunately it doesn't work for me. can you please show me this with a concrete besipiel?

@amitchandak

Hi @Anonymous ,

 

If you need measure to create [Status], then try codes below.

 

 

 

Status=

VAR _m=DATEDIFF(TODAY(), MAX('MB final'[Custom.1]),MONTH)

RETURN

SWITCH(TRUE(),

_m=0, "1.On Time",

_m>0&&_m<=3, "2.delayed 1-3 month",

_m>3&&_m<=6,"3.delayed 3-6 month",

"4.delayed >6 month"

)

 

 

 

If you need calculated column to create [Status], then try codes below.

 

 

 

Status=

VAR _m=DATEDIFF(TODAY(), 'MB final'[Custom.1],MONTH)

RETURN

SWITCH(TRUE(),

_m=0, "1.On Time",

_m>0&&_m<=3, "2.delayed 1-3 month",

_m>3&&_m<=6,"3.delayed 3-6 month",

"4.delayed >6 month"

)

 

 

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.