Forum Discussion
Redacted_VAR
Helper I
2 years agoSum Rows Until Dynamic Value is Reached
Hi All, trying to flesh out if this idea is possible, as i'm not even sure which functions to start with! I've got a basic sales table for a single salesperson: Company Revenue Com...
- 2 years ago
maybe you can try this
Column = sumx(FILTER('Table','Table'[Company]<=EARLIER('Table'[Company])),'Table'[Revenue])/sum('Table'[Revenue])Column 2 = if(ISBLANK(MINX(FILTER('Table','Table'[Column]<EARLIER('Table'[Column])&&'Table'[Column]>=0.95),'Table'[Column])),"y")then sum the column2="y" - Anonymous2 years ago
Hi,
Thanks for the soution ryan_mayu provided,it is excellent, and i want to offer some more information for user to refer to.
hello Redacted_VAR , you can try the following calculated column.
Sum_revenus = VAR _addcolumns = ADDCOLUMNS ( 'Table', "Cumm_sum", SUMX ( FILTER ( 'Table', [Company] <= EARLIER ( 'Table'[Company] ) ), [Revenue] ) ) VAR _addflag = ADDCOLUMNS ( _addcolumns, "minsum", VAR totalrevenue = SUM ( [Revenue] ) * 0.95 VAR min_cummsum = MINX ( FILTER ( _addcolumns, [Cumm_sum] >= totalrevenue ), [Company] ) RETURN min_cummsum ) RETURN MINX ( FILTER ( _addflag, [Company] = EARLIER ( 'Table'[Company] ) && [Company] <= [minsum] ), [Cumm_sum] )Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi,
Thanks for the soution ryan_mayu provided,it is excellent, and i want to offer some more information for user to refer to.
hello Redacted_VAR , you can try the following calculated column.
Sum_revenus =
VAR _addcolumns =
ADDCOLUMNS (
'Table',
"Cumm_sum",
SUMX (
FILTER ( 'Table', [Company] <= EARLIER ( 'Table'[Company] ) ),
[Revenue]
)
)
VAR _addflag =
ADDCOLUMNS (
_addcolumns,
"minsum",
VAR totalrevenue =
SUM ( [Revenue] ) * 0.95
VAR min_cummsum =
MINX ( FILTER ( _addcolumns, [Cumm_sum] >= totalrevenue ), [Company] )
RETURN
min_cummsum
)
RETURN
MINX (
FILTER (
_addflag,
[Company] = EARLIER ( 'Table'[Company] )
&& [Company] <= [minsum]
),
[Cumm_sum]
)
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.