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

Update DAX to ensure IDs set as Not known appear as 0 in a SUMX

I have some DAX given to me for another project that does a count on IDs in a dim against a fact table

 

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

 

However I have this date

 

Proj ID   Sub Proj ID

1            1

1            2

1            3

2            None

 

And At the moment Nones are causing an issue. if I put it into a table 2s arent showing.

 

I want to be able to update the above DAX to show 0 if Sub Proj ID is none but I can't figure it out.

 

Can anyone help out with the DAX change?

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @DebbieE 

 

Try this

 

Measure = IF(SELECTEDVALUE('Dim Proj'[Sub Proj ID]) = "None", 0,
   CALCULATE( SUMX(VALUES('Dim Proj'[Sub Proj ID] ),1), 'Fact Table')

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @DebbieE 

 

Try this

 

Measure = IF(SELECTEDVALUE('Dim Proj'[Sub Proj ID]) = "None", 0,
   CALCULATE( SUMX(VALUES('Dim Proj'[Sub Proj ID] ),1), 'Fact Table')

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


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.