Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello ,
I am trying to replace the unassigned value in type column with the value of type of max program. This need to be done on calculated column As showing in New Type Colum required.
ID, Program,Type, New Type
117 | 32 | # | MST |
117 | 679 | MST | MST |
Here is the DAX code:
New Type =
//Get Max Program
var MaxProgram = MAX('Table22'[Program])
//Get Max Program by ID
var MaxProgramByID = CALCULATE(MaxProgram,ALLEXCEPT('Table22','Table22'[ID]))
//Get The type of Max Program by ID
var NewType=SUMMARIZE (FILTER('Table22',('Table22'[Program]=MaxProgramByID)),'Table22'[Program],'Table22'[ID])
Return
if('Table22'[Type]="#",NewType,'Table22'[Type])
Anyhow, it gives this error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."
Solved! Go to Solution.
Hi @Anonymous ,
Please try code as below to create a calculated column.
New Type =
//Get Max Program by ID
VAR MaxProgramByID =
CALCULATE ( MAX ( 'Table22'[Program] ), ALLEXCEPT ( 'Table22', 'Table22'[ID] ) ) //Get The type of Max Program by ID
VAR NewType =
MAXX (
FILTER ( ALLEXCEPT ( Table22, Table22[ID] ), Table22[Program] = MaxProgramByID ),
[Type]
)
RETURN
IF ( 'Table22'[Type] = "#", NewType, 'Table22'[Type] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , try like
//Get The type of Max Program by ID
var NewType=SUMMARIZE (FILTER('Table22',('Table22'[Program]=MaxProgramByID)),'Table22'[Program])
Return
if('Table22'[Type]="#",maxx(NewType,[Program]),max('Table22'[Type]))
Hi @Anonymous ,
Please try code as below to create a calculated column.
New Type =
//Get Max Program by ID
VAR MaxProgramByID =
CALCULATE ( MAX ( 'Table22'[Program] ), ALLEXCEPT ( 'Table22', 'Table22'[ID] ) ) //Get The type of Max Program by ID
VAR NewType =
MAXX (
FILTER ( ALLEXCEPT ( Table22, Table22[ID] ), Table22[Program] = MaxProgramByID ),
[Type]
)
RETURN
IF ( 'Table22'[Type] = "#", NewType, 'Table22'[Type] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
74 | |
58 | |
36 | |
31 |
User | Count |
---|---|
91 | |
59 | |
59 | |
49 | |
42 |