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
Anonymous
Not applicable

Date Difference between 2 Columns

Hello,
I have a 2 table with
table A contains Start & End dates as of which i need to calculate the difference between them
Table B contains 2 other columns which i need to use as a filter.

The dax formula used is as below, but the result is far from right (it should give me only around 21 weeks but it is giving me 72 weeks

Mehanam3885_1-1698320927006.png

 

No.of Fabrication Weeks =
VAR SelectedActivityDescription = SELECTEDVALUE(ActivtiyLevelProgress[ActivityDescription])
VAR SelectedCustomText01 = SELECTEDVALUE(Equipment[CustomText01])
VAR TotalDuration =
    CALCULATE(
        SUMX(
            Equipment,
            IF(
                Equipment[CustomText01] = SelectedCustomText01,
                DATEDIFF(Equipment[InstallationStart], Equipment[InstallationEnd], WEEK)
            )
        ),
        FILTER(
            ActivtiyLevelProgress,
            ActivtiyLevelProgress[ActivityDescription] = SelectedActivityDescription &&
            ActivtiyLevelProgress[Progress] = 100
        )
    )
RETURN
    TotalDuration


Sample Dataset
Sample Dataset 

what did go wrong in the Dax formula ?

2 REPLIES 2
some_bih
Super User
Super User

Hi @Anonymous without model, it is hard to spot what could be wrong. Still, please check FILTER part of CALCULATE (ActivtiyLevelProgress[Progress] = 100)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Anonymous
Not applicable

The model size is big and contains alot on confidential data.
I have uploaded a sample of the Data in excel in the orginal post,kindly check if you can please.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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