Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a table with values classified in account,Level1 level2.
I want to sum values using this formula:
PL Totals =
SWITCH(
TRUE(),
MAX('Vicio Accounts'[Level1] = "2.Gross Margin",CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="1.Net Revenue")+CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="2.Gross Margin"))
,[PL Amount]
)but I received an error:
A single value for column 'Level1' in table 'Vicio Accounts' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.What I want to do is a sum of these two levels:
any idea how to do that?
thanks
Solved! Go to Solution.
Hi @quickbi,
You cannot use direct column names in the measure, to use column you will have to use the aggregation like min, max as specified in error.
Here's how to fix the issue:
Change the Level of Detail:
For instance:
PL Totals =
SWITCH(
TRUE(),
ALL('Vicio Accounts'[Level1]), // Ensures context includes all rows in 'Level1'
MAX('Vicio Accounts'[Level1]) = "2.Gross Margin",
CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="1.Net Revenue")+CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="2.Gross Margin")
,[PL Amount]
)This approach ensures the SWITCH function considers all rows in 'Level1' when evaluating the condition.
Aggregate Inside the SWITCH:
For example:
PL Totals =
SWITCH(
TRUE(),
MAX('Vicio Accounts'[Level1]) = "2.Gross Margin", // Checks if MAX of 'Level1' is "2.Gross Margin"
CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="1.Net Revenue")+CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="2.Gross Margin")
,[PL Amount]
)This way, the SWITCH function evaluates a single aggregated value from 'Level1' instead of the entire column.
Choose the approach that best suits your scenario.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Happy to help!
Hi @quickbi,
You cannot use direct column names in the measure, to use column you will have to use the aggregation like min, max as specified in error.
Here's how to fix the issue:
Change the Level of Detail:
For instance:
PL Totals =
SWITCH(
TRUE(),
ALL('Vicio Accounts'[Level1]), // Ensures context includes all rows in 'Level1'
MAX('Vicio Accounts'[Level1]) = "2.Gross Margin",
CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="1.Net Revenue")+CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="2.Gross Margin")
,[PL Amount]
)This approach ensures the SWITCH function considers all rows in 'Level1' when evaluating the condition.
Aggregate Inside the SWITCH:
For example:
PL Totals =
SWITCH(
TRUE(),
MAX('Vicio Accounts'[Level1]) = "2.Gross Margin", // Checks if MAX of 'Level1' is "2.Gross Margin"
CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="1.Net Revenue")+CALCULATE(SUM('PL Snapshot'[balance])/-1000,'Vicio Accounts'[Level1]="2.Gross Margin")
,[PL Amount]
)This way, the SWITCH function evaluates a single aggregated value from 'Level1' instead of the entire column.
Choose the approach that best suits your scenario.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Happy to help!
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!