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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jalaomar
Helper IV
Helper IV

Calculating number of days between two dates

Hello,

 

I am wondering if you could support me in how you can create a dax measure so that I can calculate the days between two different dates.

 

Below you can view the Matrix table, where I have one column Baseline including "Contract" and "ActualSchedule" baselines and another column with the different Tollgates phases (ITG0, ITG0.1 etc.) 

 

and I would like to add the measure in the Matrix table to display the dates difference between the two dates.

 

To display the date values in the Matrix table, I am using the following measure (in case it's needed)

Date Value = maxx(TollgateDataset, coalesce(TollgateDataset[ActualStart],TollgateDataset[ScheduleStart]))

jalaomar_0-1654252359557.png

 

Thanks!

 

BR

J

 

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @jalaomar ;

Is your problem solved? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.


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

v-yalanwu-msft
Community Support
Community Support

Hi, @jalaomar ;

Try it.

Date Value =
DATEDIFF (
    MAX ( TollgateDataset[ActualStart] ),
    MAX ( TollgateDataset[ScheduleStart] ),
    DAY
)

 If not right, can you share a simple example of data removal for sensitive information to understand the composition of your data model? and the output what you want.


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

tamerj1
Super User
Super User

Hi @jalaomar 

please ise this measure instead and activate the row totals

Date Value New =
VAR NormalValue = [Date Value]
VAR ContractValue =
    CALCULATE ( [Date Value], TollgateDataset[Baseline] = "Contract" )
VAR ActualScheduleValue =
    CALCULATE ( [Date Value], TollgateDataset[Baseline] = "ActualSchedule" )
RETURN
    IF (
        HASONEVALUE ( TollgateDataset[Baseline] ),
        NormalValue,
        ContractValue - ContractValue
    )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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