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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
eghusseinr
Frequent Visitor

Need Help in calculate the running Projects cost variation

As the list below is a sample,

I want to make a Dax "Formula" that calculate the Delta in value from month "M" to previous Month "M-1" to each project. But also exclude the first date value of that project from this formula.

i.e. Project Number :PF-10329438 , the first record was in Oct. 2022, 
so: Delta November for PF-10329438 = Oct. value - Nov. value
Delta December for PF-10329438 = Nov. value - Dec. value

another example
PF-XXXXX only have recorded in Apr. 2023 ==> to be excluded from formula as long as there are no other records for that project in the list, but next moth if the project "PF-XXXXX" get another record,
so: Delta May for PF-XXXXX = Apr. value - May value

1 ACCEPTED SOLUTION

Hi @eghusseinr 

 

Currently your [Value] column has the prefix "EGP " so it will be formatted to Text type and cannot compute the delta directly. You have to remove "EGP " and change it into number type, or create a new column to extract only the number values after "EGP ". For example, I add a [Value only] column to have only number values from [Value], and add another [Month] column based on [Date].

vjingzhang_0-1683688164509.png

 

Then you can create the following measure to compute the delta value. Add it into a visual along with [Project number] and [Month] to see the results. 

Delta = 
var _previousValue = CALCULATE(SUM('Table'[Value only]),ALLEXCEPT('Table','Table'[Project number]),'Table'[Month]=YEAR(EDATE(MAX('Table'[Date]),-1))*100+MONTH(EDATE(MAX('Table'[Date]),-1)))
var _currentValue = SUM('Table'[Value only])
return
IF(ISBLANK(_previousValue),BLANK(),_previousValue - _currentValue)

vjingzhang_1-1683688342405.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
eghusseinr
Frequent Visitor

Project numberValueDate
PF-10329438EGP 127,19410-24-2022
PF-10358883EGP 2,336,58610-24-2022
PF-10473993EGP 6,462,54310-24-2022
PF-11182775EGP 338,48610-24-2022
PF-38105310EGP 2,77610-24-2022
PF-10329438EGP 127,19411-22-2022
PF-10358883EGP 2,336,58611-22-2022
PF-10473993EGP 6,462,54311-22-2022
PF-11121349EGP 58,39311-22-2022
PF-11182775EGP 336,57711-22-2022
PF-38105310EGP 2,77611-22-2022
PF-10329438EGP 127,19412-16-2022
PF-10358883EGP 2,336,58612-16-2022
PF-10473993EGP 6,467,54312-16-2022
PF-11121349EGP 58,39312-16-2022
PF-11182775EGP 336,57712-16-2022
PF-38105310EGP 2,77612-16-2022
PF-11121349EGP 58,3931-19-2023
PF-11182775EGP 401,0171-19-2023
PF-38105310EGP 2,7761-19-2023
PF-11121349EGP 58,3932-2-2023
PF-11182775EGP 401,0172-2-2023
PF-11121349EGP 58,3933-2-2023
PF-11182775EGP 401,0173-2-2023
PF-11121349EGP 58,3934-4-2023
PF-11182775EGP 401,0174-4-2023

Hi @eghusseinr 

 

Currently your [Value] column has the prefix "EGP " so it will be formatted to Text type and cannot compute the delta directly. You have to remove "EGP " and change it into number type, or create a new column to extract only the number values after "EGP ". For example, I add a [Value only] column to have only number values from [Value], and add another [Month] column based on [Date].

vjingzhang_0-1683688164509.png

 

Then you can create the following measure to compute the delta value. Add it into a visual along with [Project number] and [Month] to see the results. 

Delta = 
var _previousValue = CALCULATE(SUM('Table'[Value only]),ALLEXCEPT('Table','Table'[Project number]),'Table'[Month]=YEAR(EDATE(MAX('Table'[Date]),-1))*100+MONTH(EDATE(MAX('Table'[Date]),-1)))
var _currentValue = SUM('Table'[Value only])
return
IF(ISBLANK(_previousValue),BLANK(),_previousValue - _currentValue)

vjingzhang_1-1683688342405.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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