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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
raymondxie
Helper II
Helper II

Filter with calculated measures

I have a table on a database which contains a field Validated of varchar.

 

I need to count the number of records with [Validated] == 'Y', I created a measure with the following formula:

Validated = CALCULATE ( Count (Result[ID]), FILTER ( Result, [Validated] == 'Y') ) 

 

I got this error message:

 

Screenshot - 28_10_2016 , 10_07_39 AM.png

 

Can anyone tell me what am I missing here and how to fix it?

 

Thank you very much.

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Validated = CALCULATE ( Count (Result[ID]), FILTER ( Result, [Validated] = "Y") ) 

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

I changed from creating column to creating measure and it works now, thank you very much. @Greg_Deckler

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

Validated = CALCULATE ( Count (Result[ID]), FILTER ( Result, [Validated] = "Y") ) 

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you @Greg_Deckler,

 

I got the following number which doesn't seem to be a count result but rather a sum result:

 

Screenshot - 28_10_2016 , 11_17_38 AM.png

The count should be something less than 50000

I changed from creating column to creating measure and it works now, thank you very much. @Greg_Deckler

Ah, I was wondering, because you said "measure" in your first post so I was thinking that couldn't be the issue!!


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

sorry about that, I just started learning PowerBI.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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