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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi everyone. I would really appreciate some help with the following issue that I have not been able to figure out after scouring the forums.
I have the following 3 tables:
Table_Visit
Visit | Procedure Code | RVU Value |
1 | 22 | 1.3 |
1 | 10 | 4.2 |
1 | 55 | 3.7 |
2 | 22 | 1.3 |
3 | 31 | 5.0 |
3 | 40 | 2.1 |
4 | 22 | 1.3 |
4 | 10 | 4.2 |
4 | 76 | 3.7 |
4 | 40 | 2.1 |
5 | 55 | 3.7 |
5 | 31 | 5.0 |
6 | 22 | 1.3 |
6 | 55 | 3.7 |
Table_ProcedureCode
Procedure Code | Category |
10 | A |
22 | A |
31 | B |
40 | B |
55 | C |
76 | C |
Table_Category
Category | Sort Order |
A | 3 |
B | 1 |
C | 2 |
I would like to create a calculated column in Table_ID that returns the Category (A, B, or C) which is associated with the Procedure Code that has the highest RVU Value for that Visit#. The result should be the same for all rows with the same Visit#.
i.e. the final new column should look like this:
Table_Visit
Visit | Procedure Code | RVU | CALCULATED COLUMN |
1 | 22 | 1.3 | A |
1 | 10 | 4.2 | A |
1 | 55 | 3.7 | A |
2 | 22 | 1.3 | A |
3 | 31 | 5.0 | B |
3 | 40 | 2.1 | B |
4 | 22 | 1.3 | A |
4 | 10 | 4.2 | A |
4 | 76 | 3.7 | A |
4 | 40 | 2.1 | A |
5 | 55 | 3.7 | B |
5 | 31 | 5.0 | B |
6 | 22 | 1.3 | C |
6 | 55 | 3.7 | C |
I need this to be a calculated column rather than a measure so that I can use it as dimensional data within the Legend field on several visual charts. I have the sort table so that I can sort the display of the categories manually.
Solved! Go to Solution.
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
This works! But now I need to ignore all individual Category A procedure codes. Just act like they aren't there.
In Visit 1, Codes 10 and 22 would be ignored. Procedure Code 55 would now be the highest RVU value and the Visit Category would change from A to C.
I have tried the following modification with a one to many relationships btw tables, but somehow it isn't filtering correctly. Instead it's returning the same Category for ALL rows...
Any ideas?
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
Hi @willit6182 - create a calculated column in Table_Visit that returns the category associated with the Procedure Code having the highest RVU Value for each Visit# as follows
HighestRVUCategory =
VAR CurrentVisit = Table_Visit[Visit]
VAR HighestRVU =
CALCULATE(
MAX(Table_Visit[RVU Value]),
FILTER(
Table_Visit,
Table_Visit[Visit] = CurrentVisit
)
)
VAR HighestRVUProcedureCode =
CALCULATE(
MAX(Table_Visit[Procedure Code]),
FILTER(
Table_Visit,
Table_Visit[Visit] = CurrentVisit &&
Table_Visit[RVU Value] = HighestRVU
)
)
RETURN
CALCULATE(
MAX(Table_ProcedureCode[Category]),
FILTER(
Table_ProcedureCode,
Table_ProcedureCode[Procedure Code] = HighestRVUProcedureCode
)
)
Check the above Hope it helps
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!