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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

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

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

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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors