Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello everyone!
I have two tables:
tblOrder
Order | Date | Value |
1001 | 01.01.2020 | 500 |
1002 | 01.01.2020 |
tblWork
Order | SEQ | State | String |
1001 | 50 | 1 | AAA |
1001 | 50 | 2 | BBB |
Now I would like to add the first table a calculated column that shows me the String for the row of tblWork where SEQ & State = MAX
How would you do that?
// Please note I'm not using CALCULATE here
// because if the tblOrder table is big,
// it would be agonizingly slow.
[String] =
var __order = tblOrder[Order]
var __maxSEQ =
MAXX(
topn(1,
filter(
tblWork,
tblWork[Order] = __order
),
tblWork[SEQ],
DESC
),
tblWork[SEQ]
)
var __maxState =
MAXX(
topn(1,
filter(
tblWork,
tblWork[Order] = __order
&&
tblWork[SEQ] = __maxSEQ
),
tblWork[State],
DESC
),
tblWork[State]
)
var __string =
MAXX(
filter(
tblWork,
tblWork[Order] = __order
&&
tblWork[SEQ] = __maxSEQ
&&
tblWork[State] = __maxState
),
tblWork[String]
)
return
__string
Best
D
Thanks for your approach! Unfortunately, I get the following error:
Calculation error in measure YXX : A single value for column 'XX' cannot be determined in table 'XX'. This can happen when a measure formula references a column that contains many values without specifying an aggregation such as 'min', 'max', 'count' or 'sum' to get a single result.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
19 | |
19 | |
15 | |
15 |
User | Count |
---|---|
49 | |
26 | |
22 | |
17 | |
16 |