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
alwalao
Frequent Visitor

Repeated/Running/Trending sum on day level

Hello everyone,

 

I am new to dax and would like some help on writing dax.

I need to create a table with repeated/running/trending sum on day level. I have two table (dimCal & fct_tble) where fct_tble is on weekly level. 

 

dimCalendar (for a month of oct)

Date
10/01/2022
10/02/2022
10/03/2022

 

fct_table (Excluding the In-Progress stage and taking only ClosedWon)

AsOfDateIdAmt_hstStg_name
10/07/2022110000ClosedWon
10/07/202225000ClosedWon
10/14/2022315000In-Progress
10/14/2022110000ClosedWon
10/14/202225000ClosedWon
10/21/202242500ClosedWon
10/21/2022110000ClosedWon
10/21/202225000ClosedWon
10/28/202255000ClosedWon
10/28/2022110000ClosedWon
10/28/202225000ClosedWon

 

Desire result (On day level) - I skipped some days but i am sure you guys get what i meant.

DateAmt_hstStg_name
10/0115000ClosedWon
10/0215000ClosedWon
10/0315000ClosedWon
10/0715000ClosedWon
10/2015000ClosedWon
10/2117500ClosedWon
10/2217500ClosedWon
10/2822500ClosedWon
10/2922500ClosedWon
10/3022500ClosedWon

 

As for now i wasn't able to get the result as per above. 

 

Here is dax that i tried:

 

Trending =
var d = MAX(dimDate[Date])
var m = CALCULATE(MAX(v_p[AsOfDate]), v_p[AsOfDate]<=d)
var s = CALCULATE([DistinctSum], FILTER(v_p, v_p[StageName__hst] = "Closed Won"), v_p[AsOfDate]=m)
return s

 

 Thanks in advance. 

2 REPLIES 2
Anonymous
Not applicable

Hi @alwalao ,

 

How's 22500 on 10/28, 10/29 and 10/30? From what I am understanding, it should be 20000.

If my understanding is wrong, please explain the calculation logic.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous 

 

My bad, i apologize for that. I missed out Id = 4 in the sum process for 10/28/2022. The fct_tble is a snapshot table so it wont leave out any rows. Desire result still remain the same

 

Here is the new fct_tble.

AsOfDateIdAmt_hstStg_name
10/07/2022110000ClosedWon
10/07/202225000ClosedWon
10/14/2022315000In-Progress
10/14/2022110000ClosedWon
10/14/202225000ClosedWon
10/21/202242500ClosedWon
10/21/2022110000ClosedWon
10/21/202225000ClosedWon
10/28/202255000ClosedWon
10/28/2022110000ClosedWon
10/28/202225000ClosedWon
10/28/202242500ClosedWon

 

Thanks for the reply.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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