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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AllanBerces
Post Prodigy
Post Prodigy

Max Number per Week

Hi pls need help on how can i have the result i required, on my table from week 1 to current on the result i want to registered 1 if the number is max and 0 if not on the particular week. sample below for week 29 and 30.

AllanBerces_0-1756804279544.png

OUTPUT

AllanBerces_1-1756804310214.png

WeekCount/TradeResult
29910
29910
29910
29910
29910
29910
29910
29910
29910
291371
291371
291371
291371
291371
291371
291371
291371
29150
29150
29150
29150
30160
30160
30160
30160
30160
30160
30160
301100
301100
301100
30890
30890
30890
301391
301391
301391
301391
30140
30140
30140
30160
30160
1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@AllanBerces 

 

You will need to create a new calculated column in your data model to determine if a value is the maximum for its respective week.

 

Result =
IF(
'YourTable'[Count/Trade] =
CALCULATE(
MAX('YourTable'[Count/Trade]),
ALLEXCEPT('YourTable', 'YourTable'[Week])
),
1,
0
)




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

Proud to be a Super User!




LinkedIn






View solution in original post

4 REPLIES 4
sanalytics
Super User
Super User

@AllanBerces 
I would recommend to create custom column rather than calculated column. Below is the M code

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrJU0lGyNFSK1aET29DYnD4cU6LZxgYgthkN2IYGxHAsLAmzDY3J4JgQwUZzeiwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Week = _t, Trade = _t]),
    TypeChanged = Table.TransformColumnTypes(Source,{{"Week", Int64.Type}, {"Trade", Int64.Type}}),
    Result = let
GroupTable =  
Table.Group( 
TypeChanged, {"Week"},{{"AllRows",each _}}
)[AllRows],
MaxTradeAdded = 
List.Transform(GroupTable,(x) =>
Table.AddColumn(x,"Result", each if [Trade] =List.Max(x[Trade]) then 1 else 0 )
),
Result = Table.Combine(MaxTradeAdded)
in
Result
in
    Result

 

Hopt this will help

 

Regards,

sanalytics

Aburar_123
Solution Supplier
Solution Supplier

Hi @AllanBerces ,

 

Please try this calculated column

Flag =
var Max_value = CALCULATE(MAX('Table'[Count/Trade]),FILTER('Table','Table'[Week]=EARLIER('Table'[Week])))
return if(Max_value='Table'[Count/Trade],1,0)
 
Aburar_123_0-1756805498404.png

 

bhanu_gautam
Super User
Super User

@AllanBerces 

 

You will need to create a new calculated column in your data model to determine if a value is the maximum for its respective week.

 

Result =
IF(
'YourTable'[Count/Trade] =
CALCULATE(
MAX('YourTable'[Count/Trade]),
ALLEXCEPT('YourTable', 'YourTable'[Week])
),
1,
0
)




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

Proud to be a Super User!




LinkedIn






Hi @bhanu_gautam thank you very much work as i need

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.