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
acg
Resolver I
Resolver I

Where Answer is 'Yes'

I want to calculate the number of Entities that had international Presence (= INT) in the last Year.

International Presence is determined by answering to [Question Code] = "Q0035" with [Answer] = "Yes"

 

As such the below calculation works EXCEPT when I add the filter

'Fact QNA'[Answer] = "Yes"

 

Is there a different way in DAX to introduce the "where 'Fact QNA'[Answer] = "Yes" ?

 

 

 

 

 Number INT Presence YearMax =
VAR MAXSD = CALCULATE(MAX('Dim Submission Date'[date]),ALLSELECTED('Dim Submission Date'))
VAR MAXYSD = CALCULATE(MAX('Dim Submission Date'[year]),'Dim Submission Date'[date] = MAXSD)
RETURN
CALCULATE
(
COUNT('Fact QNA'[Companies]),
'Fact QNA'[Answer] = "Yes",
'Dim Questions'[Question Code] = "Q0035",
'Dim Submission Date'[year] = MAXYSD
)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @acg 
can you please try 

 Number INT Presence YearMax =
VAR MAXSD = CALCULATE(MAX('Dim Submission Date'[date]),ALLSELECTED('Dim Submission Date'))
VAR MAXYSD = CALCULATE(MAX('Dim Submission Date'[year]),'Dim Submission Date'[date] = MAXSD)
RETURN
CALCULATE
(
COUNT('Fact QNA'[Companies]),
'Fact QNA'[Answer] = "Yes" && 'Dim Questions'[Question Code] = "Q0035",
'Dim Submission Date'[year] = MAXYSD
)

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @acg 

I just want to confirm have you tried the solution shared by tamerj1 and Aditya_Meshram ? Do they help? 

If you still need help, usually information below is needed, could you provide it? Thanks.

 (1) a sample file, you can replace raw data with bogus data to protect your privacy.

     or provide some sample data that fully covers your issue/question.

(2) give your expected result based on the sample you provide. If calculation formula is involved, please provide it.

Kindly note: Please ensure the data in sample is concise and representative.

Thanks.

 

Best Regards,

Community Support Team _Tang

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

tamerj1
Super User
Super User

Hi @acg 
you may try

 

Number INT Presence YearMax =
VAR MAXYSD =
    MAX ( 'Dim Submission Date'[year] )
RETURN
    CALCULATE (
        COUNT ( 'Fact QNA'[Companies] ),
        'Fact QNA'[Answer] = "Yes",
        FILTER ( 'Dim Questions', 'Dim Questions'[Question Code] = "Q0035" ),
        FILTER ( 'Dim Submission Date', 'Dim Submission Date'[year] = MAXYSD )
    )

Also it is worth it toc check the source data for possible spaces after or before "Yes"

 

Anonymous
Not applicable

Hi @acg 
can you please try 

 Number INT Presence YearMax =
VAR MAXSD = CALCULATE(MAX('Dim Submission Date'[date]),ALLSELECTED('Dim Submission Date'))
VAR MAXYSD = CALCULATE(MAX('Dim Submission Date'[year]),'Dim Submission Date'[date] = MAXSD)
RETURN
CALCULATE
(
COUNT('Fact QNA'[Companies]),
'Fact QNA'[Answer] = "Yes" && 'Dim Questions'[Question Code] = "Q0035",
'Dim Submission Date'[year] = MAXYSD
)

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.