This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA 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.
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.
OUTPUT
| Week | Count/Trade | Result |
| 29 | 91 | 0 |
| 29 | 91 | 0 |
| 29 | 91 | 0 |
| 29 | 91 | 0 |
| 29 | 91 | 0 |
| 29 | 91 | 0 |
| 29 | 91 | 0 |
| 29 | 91 | 0 |
| 29 | 91 | 0 |
| 29 | 137 | 1 |
| 29 | 137 | 1 |
| 29 | 137 | 1 |
| 29 | 137 | 1 |
| 29 | 137 | 1 |
| 29 | 137 | 1 |
| 29 | 137 | 1 |
| 29 | 137 | 1 |
| 29 | 15 | 0 |
| 29 | 15 | 0 |
| 29 | 15 | 0 |
| 29 | 15 | 0 |
| 30 | 16 | 0 |
| 30 | 16 | 0 |
| 30 | 16 | 0 |
| 30 | 16 | 0 |
| 30 | 16 | 0 |
| 30 | 16 | 0 |
| 30 | 16 | 0 |
| 30 | 110 | 0 |
| 30 | 110 | 0 |
| 30 | 110 | 0 |
| 30 | 89 | 0 |
| 30 | 89 | 0 |
| 30 | 89 | 0 |
| 30 | 139 | 1 |
| 30 | 139 | 1 |
| 30 | 139 | 1 |
| 30 | 139 | 1 |
| 30 | 14 | 0 |
| 30 | 14 | 0 |
| 30 | 14 | 0 |
| 30 | 16 | 0 |
| 30 | 16 | 0 |
Solved! Go to Solution.
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
)
Proud to be a 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
Hi @AllanBerces ,
Please try this calculated column
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
)
Proud to be a Super User! |
|
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 32 | |
| 25 | |
| 24 | |
| 24 | |
| 13 |
| User | Count |
|---|---|
| 61 | |
| 47 | |
| 27 | |
| 24 | |
| 19 |