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
DebbieE
Community Champion
Community Champion

Adding a FILTER to a VALUES step to filter out values from the list

I have the following DAX

 

Var VrReqCount =

CALCULATE (
   SUMX (
       VALUES ( 'Dim Proj'[Proj No] ),
       1
   ),
   'Fact Table')

 

RETURN IF( VrReqCount >=1 , VrReqCount,0)

 

VALUE creates me a distinct list from the Dim Table, And if the measure value is null I add a 0.

 

But I have the following

 

Project No

1

2

3

4

5

Not Known

 

I basically want to add a Filter of <> "Not Known" into the VALUES step but I just cannot figure out how to do this. 

 

Any help would be appreciated

2 REPLIES 2
sjoerdvn
Super User
Super User

if you just want to count distinct dimension values, you would probably want something like below:
(Adjust for the real column names for the relationship between the two tables. also, you do not need the if)

CALCULATE(
  DISTINCTCOUNT('Dim Proj'[Proj No]),
  'Dim Proj'[Proj No] <> 'Not Known',
  CROSSFILTER('Dim Proj'[Proj Id], 'Fact Table'[Proj Id], Both)
) + 0
  

 

sjoerdvn
Super User
Super User

short answer is below, but...

Var VrReqCount =

CALCULATE (
   SUMX (
       VALUES ( 'Dim Proj'[Proj No] ),
       1
   ),

    'Dim Proj'[Proj No] <> "Not Known",
   'Fact Table')

 

RETURN IF( VrReqCount >=1 , VrReqCount,0)

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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