Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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! |
|
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 37 | |
| 35 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 137 | |
| 102 | |
| 71 | |
| 67 | |
| 65 |