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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Error: A table of multiples values was supplied

Hi All,

 

I created a mysql query and I was trying to convert it to DAX to get the correct count, but I am getting below error:

MdxScript(Model) (46, 48) Calculation error in measure 'MeasuresTable'[On Time Release]: A table of multiple values was supplied where a single value was expected.

 

mySQL query:

select count(r.release_id) from releases r where status is not null and r.release_id in (
select distinct r.release_id from releases r , release_action ra where r.status is not null 
and (r.status in (10,11,12) or r.is_obsolete=1 or r.is_outdated=1)
and r.due_date >= ( select max(ra.updated_on) 
from releases r , release_action ra where r.status is not null and r.release_id=ra.release_id and ra.to_state in (10,11,12) 
and ra.is_active=0 and ra.is_completed=1 ) );

 

and DAX which I have created:

On Time Release = 
CALCULATE (
    //COUNT ( 'qr7approvals_dev releases'[release_id] ),
    COUNTROWS('qr7approvals_dev releases'),
    FILTER (
        'qr7approvals_dev releases',
        'qr7approvals_dev releases'[release_id]
            IN (
                CALCULATETABLE (
                    DISTINCT ( 'qr7approvals_dev releases'[release_id] ),
                    FILTER (
                        'qr7approvals_dev releases',
                        NOT ( ISBLANK ( 'qr7approvals_dev releases'[status] ) )
                            && OR (
                                CONTAINSROW ( { 10, 11, 12 }, 'qr7approvals_dev releases'[status] ),
                                OR (
                                    'qr7approvals_dev releases'[is_obsolete] = 1,
                                    'qr7approvals_dev releases'[is_outdated] = 1
                                )
                            )
                            && 'qr7approvals_dev releases'[due_date]
                                >= CALCULATE (
                                    MAX ( 'qr7approvals_dev release_action'[updated_on] ),
                                    FILTER (
                                        'qr7approvals_dev releases',
                                        NOT ( ISBLANK ( 'qr7approvals_dev releases'[status] ) )
                                            && INTERSECT (
                                                ALL ( 'qr7approvals_dev releases'[release_id] ),
                                                SELECTCOLUMNS (
                                                    FILTER (
                                                        'qr7approvals_dev release_action',
                                                        CONTAINSROW ( { 10, 11, 12 }, 'qr7approvals_dev release_action'[to_state] )
                                                            && 'qr7approvals_dev release_action'[is_active] = 0
                                                            && 'qr7approvals_dev release_action'[is_completed] = 1
                                                    ),
                                                    "release_id", 'qr7approvals_dev release_action'[release_id]
                                                )
                                            )
                                    )
                                )
                    )
                )
            )
    )
)

 I believe the error is at "CalculateTable", while I only want to use this function for condition check but it seems like it is casuing error. 

I maybe completely wrong but please help me in correcting the above issue.

 

Thanks in advance!

2 REPLIES 2
Anonymous
Not applicable

Oh yes I missed a comparison there. I wanted to compare release_id from releases table to release_id coming from Intersect.

 

So basically there are 2 tables releases and releases_action, I want the count of release_id only when the item is released within/prior to Release Due By date. A release is considered on time when it's status is either 10,11,12 whose information is in status column in release table or is marked as oboslete(is_obsolete) or outdated(is_outdated) in release table.

Also if it has completed and not active and already passed from these statuses (10,11,12) whose information is stored in release_action table in column is_completed, is_active, to_state , then those releases should also be considered.

 

And why I am doing this 

qr7approvals_dev releases'[due_date]
                                >= CALCULATE (
                                    MAX ( 'qr7approvals_dev release_action'[updated_on] ).....

is because in release action table there will be multiple updates on sinlge release_id and we are considering last updated timestapmp of that table.
Relation between both the tables:

Shreyansh_0-1648558450591.png

 

amitchandak
Super User
Super User

@Anonymous , this is a full table with Isblank in &&, it should return true or false

 

INTERSECT (
ALL ( 'qr7approvals_dev releases'[release_id] ),
SELECTCOLUMNS (
FILTER (
'qr7approvals_dev release_action',
CONTAINSROW ( { 10, 11, 12 }, 'qr7approvals_dev release_action'[to_state] )
&& 'qr7approvals_dev release_action'[is_active] = 0
&& 'qr7approvals_dev release_action'[is_completed] = 1
),
"release_id", 'qr7approvals_dev release_action'[release_id]
)
)

 

Also do not try to replicate DAX for SQL as is. What is a problem you are trying to solve

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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