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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Divya904
Helper III
Helper III

How to get difference between Fact table Date and User Input Date?

Hi Experts

 

Please help me to get the difference between Order date (fact table that) and Calendar date (User input date through slicer. This calendar has been generated by using DAX ) I have created the DAX measure as below, which is not working fine.

 

DifferenceOfPostingAndInputDate = DATEDIFF(FIRSTDATE('Sales'[Posting Date ]), FIRSTDATE('Date'[Calendar Date]),DAY )

 

FYI : I have already created a relationship between fact table and calender table.

 

Thanks in advance.

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

 

Do you get a different result when you use this formula?

 

=MIN('Date'[Calendar Date])-MIN('Sales'[Posting Date ])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish
Thanks for your help. Yes, I get different result when I use
=MIN('Date'[Posting date])-MIN('Sales'[User selected date in filter])

Or

=Max('Date'[Posting date])-Max('Sales'[User selected date in slicer ])

OR

=FIRSTDATE('Date'[Calendar Date])-FIRSTDATE('Sales'[Posting Date ])

I don’t know which function I should use here to subtract UserInput date in slicer and PostingDate.
There are several functions.
I have also tried with Datediff function as:
Number of days(measure) = Datediff(MIN('Date'[Posting Date]),MIN('Sales'[User selected date in slicer, day])

Thanks n regards

Which one of them gives you the correct answer?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish
I am not getting the required output. I am also not sure which function is 100% correct to use here. Once I am sure which function I should use, then I can check other table calculations to see if there is any issue with those.
I am just wondering is User selected date in slicer being passed to the function or not?

Thanks

I am not getting the required output. I am also not sure which function is 100% correct to use here. Once I am sure which function I should use, then I can check other table calculations to see if there is any issue with those.
Thanks

Hi,

 

The one i proposed should give you the correct answer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Divya904,


 Please help me to get the difference between Order date (fact table that) and Calendar date (User input date through slicer. This calendar has been generated by using DAX ) I have created the DAX measure as below, which is not working fine.

 

DifferenceOfPostingAndInputDate = DATEDIFF(FIRSTDATE('Sales'[Posting Date ]), FIRSTDATE('Date'[Calendar Date]),DAY )

 

FYI : I have already created a relationship between fact table and calender table.

 


 

Could you show the screenshot why the formula does not work fine? And what is your expected output.

 

If it is convenient, could you share some data sample which could reproduce your scenario, so that we can help further investigate on it?

 

Best Regards,

Cherry

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.