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.
I have two tables: 'Ticket Comments Relations' and 'Tickets'.
In 'Tickets' I have a calculated column called Earliest Employee Comment that spits out an id based on some calculations. For example, this id could be 48985. I want to then in 'Tickets' create a calculated column that looks up this id in ''Ticket Comments Relations' and checks the value in [is_customer_comment] whether it is 0 or 1. If it's 1, then it does the calculation. If it's 0 then it returns -1 as the value instead. In our example, it would come out to be -1, and skip the long calculation. I keep getting the "A single value..." error as shown in the screenshot. What am I doing wrong? How do I provide a row context?
@Anonymous , looking at the formula, you should create it as a column. Not measure
It has always been a column. I haven't done anything related to measures.
Hi @Anonymous,
From what I understand, you are creating the column [earliest employee comment] in the 'Ticket'-table. The way you have written your dax, you are not providing any context to the 'earliest employee comment'-table, and it tries to return all rows. If an ID is only present once in 'ticket comments relations', you can make use of LOOKUPVALUE(). If there is a relationship you can use RELATED().
But if an ID can have both [is customer comment]=0 and [is customer comment]=1, you would have to do something like:
earliest employee comment =
IF (
COUNTROWS (
FILTER (
'ticket comments relations',
[is customer comment] = 1
&& 'ticket comments relations'[target id] = tickets[id]
)
) >= 1,
MINX (
FILTER (
'ticket comments relations',
'ticket comments relations'[target id] = tickets[id]
&& 'ticket comments relations'[type] = 2
),
'ticket comments relations'[comment id]
),
-1
)
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
@Anonymous
I would suggest, in your measure create a variable
VAR = customer_comment = CONTAINS('Table','Table'[is_customer_comment], 1)
then use the variable in your IF function
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Hi @Anonymous
for measures you should point out to exactly cell that you use in statement
In your case you could replace IF(Table[Column], ...
to IF(MAX(Table[Column]), ...
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 |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |