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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JohannSteyn
Frequent Visitor

DAX formula to show number of days between date in the Matrix column and a date in the dataset

Hello,
This might be a very basic question, but I cannot figure it out.
I have the following information (redacted) in Table_1:
ID:       Grant_Date:
001          1 January 2021
002          1 March 2021
003          1 February 2021

I have a master date table as well.


I want to write a DAX measure in order to achieve the following on a Matrix:
(the Master Date is inserted as the "Columns" on the Matrix and the ID is inserted as the "Rows". I need a measure for the "values" in red below)

ID:30 April 202131 May 202130 June 202131 July 2021
001120151181212
0026192122153
00389120150181



1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @JohannSteyn 

 

Try this:

 

measure=
Var _MGD = MAX(Table_1[Grant_Date])
Var _MDD = MAX(Master Date[Date])
return

DATEDIFF(_MGD,_MDD,DAY)
 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/


 

 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @JohannSteyn 

 

Try this:

 

measure=
Var _MGD = MAX(Table_1[Grant_Date])
Var _MDD = MAX(Master Date[Date])
return

DATEDIFF(_MGD,_MDD,DAY)
 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/


 

 

Thank you!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.