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! Learn more

Reply
imran_uridetech
Frequent Visitor

Summarize

TempTable.jpgResult.jpg

I am trying to Summarize a Table and calculate running total in a new Table
As you can see in the attached pictures, the TempTable (1st Picture) with its DAX codes
and when I try to SUMX the Column "Summary" from TempTabel to my result table its not workig at row level, I want to add up only if the values in [Order] is less than or equal to the row value in my result table [PnL_Order], somthing similar to a running total.

Any help is appreciated.

 

1 ACCEPTED SOLUTION

Please try it with this change

 

VAR Result1=SUMMARIZE(PnL,[PnL_Order],"Amount1",
VAR _curOrder=MAX(PnL[PnL_Order])
Return SUMX(FILTER(TempTable, [Order] <=_curOrder), [Summary])
 
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
az38
Community Champion
Community Champion

hi @imran_uridetech 

not the best but maybe quickest solution

var result =
summarize(pnl, [Pnl_Order], "Amount1", 
var _curOrder = MAX ([Pnl_Order]) 
RETURN
CALCULATE(SUMX(temptable, [Summary]), temptable[Order] <= _curOrder )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

I cannot use "temptable[Order]" its coming from VAR above, so instead I tried to use it inside a FILTER and the result is same:


VAR Result1=SUMMARIZE(PnL,[PnL_Order],"Amount1",
VAR _curOrder=MAX(PnL[PnL_Order])
Return CALCULATE(SUMX(TempTable,[Summary]),FILTER(TempTable,[Order]<=_curOrder)))

Please try it with this change

 

VAR Result1=SUMMARIZE(PnL,[PnL_Order],"Amount1",
VAR _curOrder=MAX(PnL[PnL_Order])
Return SUMX(FILTER(TempTable, [Order] <=_curOrder), [Summary])
 
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Do you have any thoughts about why the same concept would not give me a result in all rows, when I use it in a Measure instead of a Table

 

ReportAmount2 =
VAR VAR_Table=SUMMARIZE(fData_2021B,[Order],"Amount1",SUMX(fData_2021B,[PnL_SAR]))

VAR ResultTable=SUMMARIZE(PnL,[PnL_Order],[ORM_FS_1],[Display],[Factor],"RunningAmount",SUMX(VAR_Table,[Amount1]))

VAR RunningAmount=
VAR VAR_CurOrder=MAX([PnL_Order])
RETURN SUMX(FILTER(ResultTable,[PnL_Order]<=VAR_CurOrder),[RunningAmount])

Return RunningAmount
Visual1.jpg

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