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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hemanth2018
New Member

Create a measure by filtering data from 2 tables

Hi,

 

I have 2 tables Incident and Project where incidentID column is the commom column from both the tables.

 

Incident table has statuses ( Rejected and approved)

 

Project table has statuses ( Not Started and In Progress)

 

now i need to create a measure like  - get the count of incidents with status  = Rejected from incidents and count of incidents in project with status in Not Started and In Progres.

 

condition is - we need to get the count for theincidents whose status is rejected and for the same incidents in project with status Not Started and In Progres.

 

Measure  = Rejected & Not Started & In Progres

 

Need help ASAP.

 

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @hemanth2018,

 

You can try to use below formula if it works for your scenario.

Measure =
VAR idList =
    CALCULATE (
        VALUES ( Incident[incidentID] ),
        FILTER ( ALLSELECTED ( Incident ), Incident[statuses] = "Rejected" ),
        VALUES ( Incident[incidentID] )
    )
RETURN
    CALCULATE (
        COUNT ( Product[incidentID] ),
        FILTER (
            ALL ( Project ),
            Project[incidentID] IN idList
                && Project[statuses] IN { "Not Started", "In Progres" }
        )
    )

 

If above not help, please share same sample data for test and coding formula.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @hemanth2018,

 

You can try to use below formula if it works for your scenario.

Measure =
VAR idList =
    CALCULATE (
        VALUES ( Incident[incidentID] ),
        FILTER ( ALLSELECTED ( Incident ), Incident[statuses] = "Rejected" ),
        VALUES ( Incident[incidentID] )
    )
RETURN
    CALCULATE (
        COUNT ( Product[incidentID] ),
        FILTER (
            ALL ( Project ),
            Project[incidentID] IN idList
                && Project[statuses] IN { "Not Started", "In Progres" }
        )
    )

 

If above not help, please share same sample data for test and coding formula.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.