cancel
Showing results 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

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 2021 31 May 2021 30 June 2021 31 July 2021 001 120 151 181 212 002 61 92 122 153 003 89 120 150 181

1 ACCEPTED SOLUTION
MVP

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.

2 REPLIES 2
MVP

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.

Frequent Visitor

Thank you!

Announcements

#### 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.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### 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
Top Kudoed Authors