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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors