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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
myou
Helper II
Helper II

Convert Excel Formula to DAX

Hello,

 

I have this table in Excel It contains

1. Date

2. Col1 is a fixed column

3. Col3 is a fixed column

I want to compute Col2 and Col4

 

Cap1.PNG

Starting with Col2

1. Col2 Starts with same value in B2 (because nothing is in previous values)

2. Then in Month 2 , C3 = B3+C2 - D3 = 4

I know how to access previous value in DAX, but wont help much

 

 

CALCULATE(
sum(Table[Col1]),
PREVIOUSMONTH(Table[Date]),
)

 

 

Issue Persists in the steps below( in Month3) , now I want to use values that were computed in step above

 

Cap2.PNG

How can I do it in DAX for the highlighted cells ?

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @myou,

It seems like a simple rolling total of [B] -[D] fields with condition that less than or equal to the current row. You can create calculated columns with below formulas to achieve your requirement:

C =
SUMX (
    FILTER ( 'Table', [Date] <= EARLIER ( 'Table'[Date] ) ),
    [B] - [D]
)

E = Table[C]-Table[D]

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @myou,

It seems like a simple rolling total of [B] -[D] fields with condition that less than or equal to the current row. You can create calculated columns with below formulas to achieve your requirement:

C =
SUMX (
    FILTER ( 'Table', [Date] <= EARLIER ( 'Table'[Date] ) ),
    [B] - [D]
)

E = Table[C]-Table[D]

Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

@myou , prefer to use a date calendar and take month from that

 

Cumm =
CALCULATE(SUM(Table[B]),filter(date,date[date] <=max(Table[Date]))) // Or the first value of B
+ CALCULATE(SUM(Table[C]),filter(date,date[date] <=max(Table[Date])))
-CALCULATE(SUM(Table[D]),filter(date,date[date] <=max(Table[Date])))

 

All are cumulative totals. The one from B can the first value 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

Why Table[C] is repeated twice ?

 

@myou , updated the post. It needs be column D

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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.