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

Date formatting issue

Hi community!
Have an issue to ask you help with.
By the code below I'm trying to get value for the last available day in the previouse year (as you see the hardcoded part - it's Dec 28). 

LastYear Bill FTE = 
CALCULATE (
    SUM (Billed_FTE[BilledFTE]),
    FILTER ( 
        ALLEXCEPT (Billed_FTE, Billed_FTE[Client] ),
        Billed_FTE[Date] = DATE (2018,12,28)
    )
)

Actually, it works. But I need to get rid from that hardcoded part, because next year this date may be different. So I created a new mesure, that gives me a result - 28-Dec-18

LastYearLastDate = 
CALCULATE (
    LASTDATE ( Billed_FTE[Date] ),
    FILTER (
        ALLEXCEPT ( Billed_FTE, Billed_FTE[Client] ),
        Billed_FTE[Year] = MAX ( Billed_FTE[Year] ) -1
    )
)

But when I change my hardcoded date to this [LastYearLastDate] mesure - it doesnt work properly. Looks like there is a date formatting issue and power BI don't recognize my  [LastYearLastDate] mesure as a date or I don't know. 
Please, help! 🙂

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

Because embed measure into a measure may occur some error regardless of date format, you can try to calculate the date into a var before using it to filter like following.

 

LastYear Bill FTE = 
VAR d = [BilledFTE]
RETURN
    CALCULATE (
        SUM ( Billed_FTE[Client] ),
        FILTER ( ALLEXCEPT ( Billed_FTE, Billed_FTE[Client] ), Billed_FTE[Date] = d )
    )

Date-formatting-issue-1.png

 

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more

Community Support Team _ Dong Li
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
Anonymous
Not applicable

@v-lid-msft  Thank you soooo much! That works perfectly.

v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

Because embed measure into a measure may occur some error regardless of date format, you can try to calculate the date into a var before using it to filter like following.

 

LastYear Bill FTE = 
VAR d = [BilledFTE]
RETURN
    CALCULATE (
        SUM ( Billed_FTE[Client] ),
        FILTER ( ALLEXCEPT ( Billed_FTE, Billed_FTE[Client] ), Billed_FTE[Date] = d )
    )

Date-formatting-issue-1.png

 

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors