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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
pagarc1
Frequent Visitor

I'm getting an error A single value for column 'Department' in table 'DIA SALES DATA' cannot be dete

Order Type = if('DIA SALES DATA'[Department]="24HRTS","DTP Nonrevenue",IF('DIA SALES DATA'[Department]="Distributor","Distributor","DTP Revenue"))
 
error below
A single value for column 'Department' in table 'DIA SALES DATA' 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.
5 REPLIES 5
az38
Community Champion
Community Champion

Hi @pagarc1 

as you use a measure the DAX cannot understand what exactly cell of Department column you want to use for comparing.

So try to use SELECTEDVALUE() if you are trying to compare value in each rows, like

Order Type = if(SELECTEDVALUE('DIA SALES DATA'[Department])="24HRTS","DTP Nonrevenue",IF(SELECTEDVALUE('DIA SALES DATA'[Department])="Distributor","Distributor","DTP Revenue"))

or better use SWITCH() statement

SWITCH(
SELECTEDVALUE('DIA SALES DATA'[Department]),
"24HRTS","DTP Nonrevenue",
"Distributor","Distributor",
"DTP Revenue"
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi @pagarc1 ,

 

In measure you can not refer column directly.

Your dax will work for calculated column not for measure.

 

Incase you want to do the calculation using measure add 'min'/'max'/Selectevalue before column name

 

Order Type = if(max('DIA SALES DATA'[Department])="24HRTS","DTP Nonrevenue",IF(max('DIA SALES DATA'[Department])="Distributor","Distributor","DTP Revenue"))

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Anonymous
Not applicable

You can add only columns as slicer.

 

Create calculated column as below

 

Order Type = if('DIA SALES DATA'[Department]="24HRTS","DTP Nonrevenue",IF('DIA SALES DATA'[Department]="Distributor","Distributor","DTP Revenue"))

 

Note:

Measures are used for aggrigation and dynamic calculations.

Measure can be used as visual level filters but measures can be used in slicers.

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

pagarc1
Frequent Visitor

I want to do something like this. I want to add it on a slicer although the previous formula worked. I couldn't add the field into a slicer.

ordertype.png

Chthonian
Helper III
Helper III

Hi @pagarc1 ,

 

While I cannot definitively answer why you are getting this without seeing your Data Model, in my experience when you get this type of error it is generally down to the data model relationships and setup. 

 

A good resource on this:

DAX error messages in Power BI 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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