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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.