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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.