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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AvPowerBI
Post Patron
Post Patron

Calculated Column with IF Statement across two tables

Hi,

 

I have a fact table that joins to a calendar table.

I want to created a calculated column but I am getting the following message

 

A single value for column 'Current MTD' in table 'Calendar' 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.

 

My DAX formula is the following:

 

Pending CMTD or PMTD =
IF('Fact'[Outcome] ="Pending" && 'Calendar'[Current MTD]=1 || 'Calendar'[Previous MTD]=1,"Yes","No")
 
Thanks
1 ACCEPTED SOLUTION

Hi,

Via the RELATED() function, bring over the CMTD and PMTD columns from the Calendar Table to the Fact Table and then write this calculated column formula in the Fact table

Pending CMTD or PMTD =
IF('Fact'[Outcome] ="Pending" && ('Fact'[Current MTD]=1 || 'Fact'[Previous MTD]=1),"Yes","No")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
OliT
Resolver I
Resolver I

Hi @AvPowerBI 

Is your problem solved? Do you still need help now?

 

Regards,

OliT

Ashish_Mathur
Super User
Super User

Hi,

What is the purpose of creating a calculated column formula?  Why not a measure?  What exactly are you trying to achieve?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I did try and do a mesaure but got the same error.

I basically want to add this calculated column to the filter pane, so the end user can select Yes or No based on the If Statement condition

 

When I add the three individual fields in question

 

[Outcome]

[Current MTD]

[Previous MTD]

 

selecting the [Outcome] of Pending works

but when I select [Current MTD] to 1 then [Previous MTD] will only show values of 0 and vice versa when I select [Previous MTD] to 1 the only values I see for [Current MTD] are 0

 

Thats why I want have this new calculated column that does it but it is not working.

Hi,

Via the RELATED() function, bring over the CMTD and PMTD columns from the Calendar Table to the Fact Table and then write this calculated column formula in the Fact table

Pending CMTD or PMTD =
IF('Fact'[Outcome] ="Pending" && ('Fact'[Current MTD]=1 || 'Fact'[Previous MTD]=1),"Yes","No")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 I have tried the following DAX based on your recommedations

 

 

Pending CMTD or PMTD = 
        IF(
                'Fact'[Outcome] ="Pending" 
                && (
                RELATED('Calendar'[Current MTD])=1 
                || 
                RELATED('Calendar'[Previous MTD])=1
                   )
                ,"Yes"
                ,"No"
          )

 

 

But I still get the error message:

 

A single value for column 'Outcome' in table 'Fact' 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.

 

Is there something wrong with the DAX formula I have edited?

 

Thanks

Hi,

Ensure you write that as a calculated column formula (not as a measure).


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors