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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AkshayManke
Helper II
Helper II

Calculating Two Values and Comparing with If Condition

Hi Everyone, 

 

I have the below table. 

ProjectActivity NameStatus

Project A

Activity AComplete
Project BActivity AOn Hold
Project CActivity AComplete
Project DActivity AComplete
Project EActivity BActive
Project EActivity CComplete
Project EActivity DOn Track
Project EActivity EOn Track
Project EActivity FActive

 

As can be seen, there are multiple projects with associated activities. 

 

In the report i have two visuals. One is for Unique Project Name and another is for Activity.

 

What i want is, if all the activities of a specific project are having status as 'Complete' then the project should show as completed else not.

 

Can anyone please help on how to achieve this please. I can provide more information if needed. 

 

Thanks in advance.

 

Regards,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AkshayManke ,

 

Do you want to calculate the count of Completed Project Name ? I think you can add number type 1 in [Completed Projects 1] measure directly and then create a new measure based on it.

Completed Projects 1 = 
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Project'[Status] ),
        ALLEXCEPT ( 'Project', 'Project'[Project Name] )
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
    IF ( AND ( "Complete" IN _STATUS_LIST, _COUNT = 1 ), 1 )
Count of Complete =
SUMX ( VALUES ( Project[Project Name] ), [Completed Projects 1] )

Result is as below.

RicoZhou_0-1651729265041.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @AkshayManke ,

 

I think you can try this code to achieve your goal.

Measure = 
VAR _STATUS_LIST = CALCULATETABLE(VALUES('Table'[Status]),ALLEXCEPT('Table','Table'[Project]))
VAR _COUNT = COUNTAX(_STATUS_LIST,[Status])
RETURN
IF(AND("Complete" IN _STATUS_LIST,_COUNT = 1),"Complete")

Result is as below.

RicoZhou_0-1651464684290.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @Anonymous,

 

The given solution is working perfectly as expected. Thanks a lot for the same. Just one more help needed. I am getting the output in string whereas i want to show the status in values in a Card visual. So how to convert the measure from string to number? Can you please help for that ?

 

I have slightly modified the dax as below.

 

Completed Projects 1 =
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Project'[Status] ),
        ALLEXCEPT ( 'Project', 'Project'[Project Name] )
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
    IF ( AND ( "Complete" IN _STATUS_LIST, _COUNT = 1 ), "1" )

 

 

Warm Regards,

Akshay

Anonymous
Not applicable

Hi @AkshayManke ,

 

Do you want to calculate the count of Completed Project Name ? I think you can add number type 1 in [Completed Projects 1] measure directly and then create a new measure based on it.

Completed Projects 1 = 
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Project'[Status] ),
        ALLEXCEPT ( 'Project', 'Project'[Project Name] )
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
    IF ( AND ( "Complete" IN _STATUS_LIST, _COUNT = 1 ), 1 )
Count of Complete =
SUMX ( VALUES ( Project[Project Name] ), [Completed Projects 1] )

Result is as below.

RicoZhou_0-1651729265041.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hello @Anonymous,

 

The given formula worked as expected.. 🙂

Thanks a ton for your great help on this. 

 

Warm Regards,

Akshay

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors