Forum Discussion
Anonymous
6 years agoNot applicable
Bucket wise sales
Hi Sales 100 50 20 30 120 200 300 Above sales data i want to convert bucket wise sales: Bucket Sales 0-30 20 0-30 30 31-60 50 >61 100 >61 1...
- Anonymous6 years ago
Anonymous
Create a separate table (Bucket) as below.
Sales Bucket Lower Upper 0-30 0 30 31-60 31 60 >=61 61 Then create this calculated column in your table.
Bucket = VAR X = Sales[Amount] VAR Filtered = FILTER ( 'Bucket', VAR Y = 'Bucket'[Upper] RETURN 'Bucket'[Lower] <= X && IF ( ISBLANK ( y ), TRUE (), Y >= X ) ) RETURN MAXX ( Filtered, Bucket[Sales Bucket] )Appreciate with kudos.
Please mark as solution if this resolves your problem.
Thanks
- 6 years ago
Hi Anonymous ,
If "Sales" is a column, then you can add a calculated column in your table like so:
Bucket = SWITCH ( TRUE (), [Sales] >= 0 && [Sales] <= 30, "0-30", [Sales] >= 31 && [Sales] <= 60, "31-60", [Sales] >= 61, ">61" )Or, create a measure:
Bucket = SWITCH ( TRUE (), SUM ( 'Table'[Sales] ) >= 0 && [Sales] <= 30, "0-30", SUM ( 'Table'[Sales] ) >= 31 && [Sales] <= 60, "31-60", SUM ( 'Table'[Sales] ) >= 61, ">61" )If "Sales" is a measure, then create a measure like so:
Bucket = SWITCH ( TRUE (), [Sales] >= 0 && [Sales] <= 30, "0-30", [Sales] >= 31 && [Sales] <= 60, "31-60", [Sales] >= 61, ">61" )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
6 years agoNot applicable
Anonymous
Create a separate table (Bucket) as below.
| Sales Bucket | Lower | Upper |
| 0-30 | 0 | 30 |
| 31-60 | 31 | 60 |
| >=61 | 61 |
Then create this calculated column in your table.
Bucket =
VAR X = Sales[Amount]
VAR Filtered =
FILTER (
'Bucket',
VAR Y = 'Bucket'[Upper] RETURN 'Bucket'[Lower] <= X
&& IF ( ISBLANK ( y ), TRUE (), Y >= X )
)
RETURN
MAXX ( Filtered, Bucket[Sales Bucket] )
Appreciate with kudos.
Please mark as solution if this resolves your problem.
Thanks