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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.