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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

Calculate: A table of multiple values was supplied where a single value was expected.

Hi guys,

Last year my collegue wrote a dax formula for my BI report. Unfortunately he is no longer working at my firm. Couple of days ago the datasource of my report was moved into the cloud. I already changed the location of the datasource in my report, but the Dax formula he wrote for me doesn't work since then. I tried a couple of things but it wouldn't work. The error is: A table of multiple values was supplied where a single value was expected. Can someone help me? Thank you!

The dax formula: 

 
EmployeeKey =
CALCULATE(
DISTINCT('DimEmployee'[EmployeeKey]),
FILTER('DimEmployee',
'FactActualHoursAll'[TT_EMP_ID] = 'DimEmployee'[EmployeeId] &&
'FactActualHoursAll'[TT_date] >= 'DimEmployee'[RowEffectiveDate] &&
'FactActualHoursAll'[TT_date] <= 'DimEmployee'[RowExpirationDate]
)
)
 
klchan06_0-1640183457207.png

 

 



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

You can try to add all() or allselect() to the function

EmployeeKey =
CALCULATE (
    DISTINCT ( 'DimEmployee'[EmployeeKey] ),
    FILTER (
        ALLSELECTED ( 'DimEmployee' ),
        'FactActualHoursAll'[TT_EMP_ID] = 'DimEmployee'[EmployeeId]
            && 'FactActualHoursAll'[TT_date] >= 'DimEmployee'[RowEffectiveDate]
            && 'FactActualHoursAll'[TT_date] <= 'DimEmployee'[RowExpirationDate]
    )
)

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi  @Anonymous ,

You can try to add all() or allselect() to the function

EmployeeKey =
CALCULATE (
    DISTINCT ( 'DimEmployee'[EmployeeKey] ),
    FILTER (
        ALLSELECTED ( 'DimEmployee' ),
        'FactActualHoursAll'[TT_EMP_ID] = 'DimEmployee'[EmployeeId]
            && 'FactActualHoursAll'[TT_date] >= 'DimEmployee'[RowEffectiveDate]
            && 'FactActualHoursAll'[TT_date] <= 'DimEmployee'[RowExpirationDate]
    )
)

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

VahidDM
Super User
Super User

Hi @Anonymous 

 

 

Can you post sample data as text and expected output?

please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

It looks like you're trying to add a calculated column onto your fact table from a slowly changing dimension, DimEmployee.

The issue is DISTINCT returns a table, and tables can't be embedded in another table.

You should be using a function that returns a scalar.  You could have MAX, MIN, or perhaps SELECTEDVALUE, with a default for when there's more than one row in DimEmployee that meets the filter condition.

 

Anonymous
Not applicable

Hi, thanks for your response! How do i implemented this in the dax formula? 

HotChilli
Community Champion
Community Champion

Test it by replacing DISTINCT with DISTINCTCOUNT.  If you get results of greater than 1, that's the problem.

 

Anonymous
Not applicable

Hi, I did it. I get 10 rows of number 2 and that's it. How do i fix this? 

klchan06_0-1640189236765.png

 

So you have multiple rows in DimEmployee that meet this condition

 
'FactActualHoursAll'[TT_EMP_ID] = 'DimEmployee'[EmployeeId] &&
'FactActualHoursAll'[TT_date] >= 'DimEmployee'[RowEffectiveDate] &&
'FactActualHoursAll'[TT_date] <= 'DimEmployee'[RowExpirationDate]
 
I would try to find out why.  Choose a row of the fact table from your screenshot and see which rows are matching in DimEmployee.
You mentioned the datasource has moved.  Just throwing out ideas but, as your condition includes dates, perhaps there's something different about the date formats in the new datasource?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.