Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Asma
Frequent Visitor

create a new measure in Power BI

Hello everyone, I am trying to create a measure In Power BI using the direct query mode 

I am trying to add a measure that indicate if a case is fixed at first time or not fixed at first time, A Case will ber considered fix first time if the Case only has ONE Work Order(NumberofWO) and the Case status (Case Status Name) = complete OR inactive

this is the DAX function that i used 

           

   

 Fixtfirstperformance = IF(([NumberofWO]= 1) && ([Case Status Name] ="complete" || [Case Status Name] ="inactive");"Fixt first time";"Not fixt first time")

 

I got this error 

A single value for column 'Case Status Name' in table 'incident' 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.

 

Can Someone help me please

 

3 REPLIES 3
v-huizhn-msft
Employee
Employee

Hi @Asma,

Please create a calculated column using the formula rather than measure, and check if it works fine. 

Measures are used in some of the most common data analysis; for example, sums, averages, minimum or maximum values, counts, or more advanced calculations you create yourself using a DAX formula. Measures should return one value based on calculated, while it will return nutiple results(one result for each row) if you use If function. Unsualy, we use if function in calculated columns.

If you have other issues, don't hesitate to let me know.

Best Regards,
Angelia





Hello!  thank you very much for your answer, the problem is that I am using the direct query mode, so i can't add a column and use a DAX Formula ! what do you suggest me doing ? 

 

Best Regards,
Asma

Hi @Asma,

Year, you can create measure, you can review more details from here. While we can't use if function in Diret Query model, you can vote for an exist request which has already been created here. Thanks for understanding.

Best Regards,
Angelia

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.