Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I would like to creat a measure base on condition of two table column.
if column: BAT_TYPE is A, and column: CAPACITY_AH is 210, then value should be 168
if column: BAT_TYPE is A, and column: CAPACITY_AH is 100, then value should be 80
if column: BAT_TYPE is E, and column: CAPACITY_AH is 240, then value should be 120
if column: BAT_TYPE is S, and column: CAPACITY_AH is 225, then value should be 45
the dax code writen is as following:
I got following error meesage:
A single value for column 'BAT_TYPE' in table 'Table' 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.
Thanks in advance!
Solved! Go to Solution.
hi @reynold522
A measure depends heavely on the filter context. Without knowing the filter context, there is always issue.
Why don't create a calculated column with the same code and plot a visual with that column?
Actually the way you use SWITCH is the typical way of using SWTCH for calculated columns.
hi @reynold522
A measure depends heavely on the filter context. Without knowing the filter context, there is always issue.
Why don't create a calculated column with the same code and plot a visual with that column?
Actually the way you use SWITCH is the typical way of using SWTCH for calculated columns.
thanks, actually I made it before your answer.
Anyway, thanks! I accept your solution as answer.
hi @reynold522
It is always the best to raise a question, discuss with someone, then realize the solution by oneself.
Hi @reynold522 ,
You could use below code if you are using these columns on the visual:-
Capacitythreshold =
SWITCH (
TRUE (),
MAX ( Table[BAT_TYPE] ) = "A"
&& MAX ( Table[CAPACITY_AH] ) = 210, 168,
MAX ( Table[BAT_TYPE] ) = "A"
&& MAX ( Table[CAPACITY_AH] ) = 100, 80,
MAX ( Table[BAT_TYPE] ) = "E"
&& MAX ( Table[CAPACITY_AH] ) = 240, 120,
MAX ( Table[BAT_TYPE] ) = "S"
&& MAX ( Table[CAPACITY_AH] ) = 225, 45,
BLANK ()
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
sorry it is grammatically correct however, not able to generate the result I need.
Still thanks
Can you share the sample data(raw not screenshot) with expected output pls?
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
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 |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |