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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Rajat
Frequent Visitor

Retrive a value from multiple matching records

 

Project Master                                                                                         Task Allocation

 

ProjectID  projectName  Project Status                                                 Task ID   ProjectiD  Task status

  P1            A                                                                                           T1          P1           Completed

  P2            B                                                                                           T2          P1            In progress

  P3            C                                                                                           T3          P1            Completed

                                                                                                                T4          P2           Inprogress

                                                                                                                T5          P2           Completed

                                                                                                                T6          P2           In progress

 

 

I need to update "Project status" in Project Master in such a way that if any of the task of Project is in progress then we need to update "Project status"  as "In progress" othervise "Completed".

 

Can any one tell me, how to approach this problem.

 

I tried it with LookupValue(),but is works only for one matching record.But here are multiple matching record.

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@Rajat, First, please do not cross-post in every forum, that's not cool. A lot of us use the "All Topics" view and so we see your post four times and have no idea which one to respond to.

 

Second, try something like this:

 

IF(COUNTAX(FILTER('Task Allocation'[Task status]='In Progress'),[Task ID]) = 0,"In progress", "Completed)

 

 

 

 



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

 thanks @Greg_Deckler for reply and i will not do it again.

Status = 
IF(
    ISEMPTY(
        CALCULATETABLE(
            'Task Allocation'
            ,'Task Allocation'[Task Status] = "In Progress"
        )
    )
    ,"Completed"
    ,"In Progress"
)

This assumes a relationship between 'Project Master' and 'Task Allocation'.

 

CALCULATETABLE() will respect the row context of [Project ID] from 'Project Master' and give us the matching rows from 'Task Allocation'. Additionally, we apply a filter to return only rows where 'TaskAllocation'[Task Status] = "In Progress". We test the resulting table with ISEMPTY() which tests what it says. If there are no rows, we know the project is complete. If there are rows with "In Progress", then the project is in progress.

RakeshP
Helper I
Helper I

SELECT PM.ProjectID, PM.projectName,
CASE WHEN T.ProjectID IS NULL THEN 'Completed' ELSE 'In progress' END as ProjectStatus
FROM Project_Master PM,
(SELECT distinct ProjectiD
from task_allocation
where Task_status = 'In progress') t
WHERE pm.ProjectID = t.ProjectiD(+)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.