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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
EndriuBlack
Frequent Visitor

Datediff function doesn't "see" datas from fact table

Hello,

I'm using Power Bi Desktop Report Server version from may 2022.

 

I'm trying to use DATEDIFF function to calculate days between two dates. Unfortunately when I want to use as argument a date from a data table I can only see measures. I was trying to add a calculated column in fact tabel and all went well. The "datediff" function acted correctly but I see I cannot use this solution in my report becouse refreshing data lasts too long. So I need to create a measure but I don't know where is a problem.

 

EndriuBlack_1-1668249552625.png

 

 

If somebody has an idea what can be wrong in my model I would be very grateful for help 🙂

 

Best regards,

Andrew

 

 

1 ACCEPTED SOLUTION
vojtechsima
Super User
Super User

Hi, @EndriuBlack ,
For measures, there's not row context. So you cannot use directly the columns, you need to aggreagate your data so some aggregation fucntion such as MAX. IF you wrap it to MAX, then you can use the column.
Since measures are calculated only based on current filter context, you don't have access to rows context.

You can also use X function to retrieve that row context and access the rows (MAXX).

 

View solution in original post

2 REPLIES 2
vojtechsima
Super User
Super User

Hi, @EndriuBlack ,
For measures, there's not row context. So you cannot use directly the columns, you need to aggreagate your data so some aggregation fucntion such as MAX. IF you wrap it to MAX, then you can use the column.
Since measures are calculated only based on current filter context, you don't have access to rows context.

You can also use X function to retrieve that row context and access the rows (MAXX).

 

Thank You !

Now I understand it. I have used MAX function for both dates and the measure works. I see that calculating last very long so I cannot use this parameter in my report but now I know more for the future 😉

 

Best Regards,

 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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