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

Is it possible to calculate difference between a dynamic date and a static date

Hi All,

 

I have a column called entry date in Table A and created a date table called DateDim having column Date. 

When I'm creating the below measure I'm getting error.

 

Measure 2 = DATEDIFF(('Process Detail'[entry_date]),'DateDim1'[Date],DAY)
Error:
A single value for column 'Date' in table 'DateDim1' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
 
So I tried to create it as a column with same logic but now I'm ending up with below error.
Error:
A single value for column 'entry_date' in table 'Process Detail' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
 
I have created the join betwwen the two tables A and DateDim. Can anyone help me how to acheive this.
Note:
I'm using the Date column from Datedim as a slicer and I need to calculate difference between days of entry date and the selected date(Slicer from datedim)
 
Thanks,
Anand
 
1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want to get the date diff between the max date of your selected date and the 'Process Detail'[entry_date], you can try my method:

  1.      You should delete the relationship between the two tables because the Slicer will affect the value displayed in the table chart if they have a relationship:

v-robertq-msft_0-1608259096717.png

 

  1.      Then you can create this measure:

Datediff =

var _selecteddate=MAXX(ALLSELECTED('DateDim'),'DateDim'[Date])

return

DATEDIFF(MAX('Process Detail'[entry_date]),_selecteddate,DAY)

  1.      Then place this measure into the table chart, you can get what you want, like this:

v-robertq-msft_1-1608259096727.png

 

And You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want to get the date diff between the max date of your selected date and the 'Process Detail'[entry_date], you can try my method:

  1.      You should delete the relationship between the two tables because the Slicer will affect the value displayed in the table chart if they have a relationship:

v-robertq-msft_0-1608259096717.png

 

  1.      Then you can create this measure:

Datediff =

var _selecteddate=MAXX(ALLSELECTED('DateDim'),'DateDim'[Date])

return

DATEDIFF(MAX('Process Detail'[entry_date]),_selecteddate,DAY)

  1.      Then place this measure into the table chart, you can get what you want, like this:

v-robertq-msft_1-1608259096727.png

 

And You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

amitchandak
Super User
Super User

@Anonymous , you need to use aggregation and row context

refer my blog : https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451

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

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