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
deeave
Frequent Visitor

Measure returning all missing instead of projects missing baseline 0

I'm attemtping to return a value of 1 when baselinenumber 0 does not exist in the projects baseline 2 table.  The below measure is showing all projects do not have a baseline 0 when it should only show 15 that do not have one.  
 
COUNTROWS (
    FILTER (
        'projects data2',
        NOT(             'projects data2'[projectid] IN
            CALCULATETABLE (
                VALUES ('projects baseline2'[projectid]),
                'projects baseline2'[baselinenumber] = 0
            )
        )
    )
)
4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Share data of the 2 tables in a format that can be pasted in an MS Excel file and for those 2 tables, show the expected result.


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

deeave_0-1687519776312.png

The excel shows the two fields.  Project ID and Baselinenumber.  In the Projects Baseline table, the ProjectID can have Baselinenumber 0, 1, 2, 3, etc.  Baselinenumber 0 is the primary baseline used for project schedules and we want to show in the table with the X's what projects DO NOT have a baseline 0.  We don't care about the 1, 2, 3, etc.  Here is my SQL query that is successful at returning the correct projects.

 

SELECT DISTINCT d.projectnumber, d.projectname
FROM [dbo].[Projects Data2] d
WHERE d.projectnumber is not null
and d.projectstatus = 'active'
and NOT EXISTS ( 

SELECT 1
FROM [dbo].[Projects Baseline2] b
WHERE b.ProjectID = d.ProjectID
AND b.BaselineNumber = '0');

Hi,

Write this measure

Measure = calculate(distinctcount(Data[ProjectID]),Data[baselinenumber]<>0)

Hope this helps.


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

@deeave , Try like

 

COUNTROWS (summarize(Filter( 'projects baseline2','projects baseline2'[baselinenumber] = 0 ), 'projects baseline2'[projectid]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.