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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
CBrinky
Frequent Visitor

Creating a "Current Activity Flag" based on different scenarios.

Hi all, 

 

I've done my best to research this, using forums, google, chatgpt to create a solution. I just can't get my head around this. 

I have 3 different project scenarios where you can see what the "current activity" is. Based on predecessors, dates, task_id, project id etc.

CBrinky_0-1702876210513.png

It works with the below example as it only has 1 "predecessor" with start/finish date

CBrinky_1-1702876733058.png

I don't know how to adjust it so in this scenario it only shows "Surface Treatment" as the current activity. 

CBrinky_2-1702876763626.png

And I don't know how to adjust it so in this scenario it just displays as "Job complete"

CBrinky_3-1702876833386.png

Successor =

VAR PredecessorID = 'RAW_TASK/PRED_MERGED'[TASK PREDECESSOR]
VAR PredecessorStatus =
    CALCULATE(
        COUNTROWS('RAW_TASK/PRED_MERGED'),
        FILTER(
            'RAW_TASK/PRED_MERGED',
            'RAW_TASK/PRED_MERGED'[TASK_ID] = PredecessorID &&
            NOT ISBLANK('RAW_TASK/PRED_MERGED'[ACT_START_DATE]) &&
            NOT ISBLANK('RAW_TASK/PRED_MERGED'[ACT_END_DATE])
        )
    )
RETURN
    IF(
        PredecessorStatus > 0,
        "Current Activity",
        BLANK()
    )



 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @CBrinky ,

You can use this DAX:

Measure 2 = 
var _countend=COUNTX(ALLSELECTED('Table'),'Table'[ACT_END_DATE])
var _countname=COUNTX(ALLSELECTED('Table'),'Table'[TASK_NAME])
var _maxend=MAXX(ALL('Table'),'Table'[ACT_END_DATE])
var _maxid=
CONCATENATEX(
    FILTER(ALL('Table'),'Table'[ACT_END_DATE]=_maxend),[TASK_ID],"-")
return
IF(
    _countend=_countname,"Job complete",
IF(
   CONTAINSSTRING(
    _maxid,MAX('Table'[TASK PREDECESSOR]))=TRUE()&&MAX('Table'[TASK PREDECESSOR])<>BLANK(),
"current activity", BLANK()))

I didn't use "switch", but it work in my situation.

Best Regards,
Dino Tao
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

3 REPLIES 3
Anonymous
Not applicable

Hi @CBrinky ,

Please try this way:
Use this DAX to create a new measure:

Successor = 
VAR _MAXEND = MAXX(ALL('Table'), 'Table'[ACT_END_DATE])
VAR _MAXID = MAXX(FILTER(ALL('Table'), 'Table'[ACT_END_DATE] = _MAXEND), [TASK_ID])
RETURN
IF(
    MAX('Table'[TASK PREDECESSOR]) = _MAXID, "current activity", BLANK())

vjunyantmsft_0-1702972784172.png


And about "Job complete", you can use these DAXs:

Successor1 = 
IF(
    CALCULATE(
        COUNTROWS('Table2'),
        NOT(ISBLANK('Table2'[ACT_END_DATE]))
    ) = COUNTROWS('Table2'),
    "Job complete"
)

Or

Successor2 = 
IF(
    COUNTBLANK(Table2[ACT_END_DATE]) > 0,
    "non-complete",
    "Job complete"
)


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

Hi Dino, 

 

Is there a way to maybe use the "switch" function to combine these solutions? So it'd check if it means 1 condition, and if it doesn't it checks if it meets the next condition? Your help is greatly appreciated!

Anonymous
Not applicable

Hi @CBrinky ,

You can use this DAX:

Measure 2 = 
var _countend=COUNTX(ALLSELECTED('Table'),'Table'[ACT_END_DATE])
var _countname=COUNTX(ALLSELECTED('Table'),'Table'[TASK_NAME])
var _maxend=MAXX(ALL('Table'),'Table'[ACT_END_DATE])
var _maxid=
CONCATENATEX(
    FILTER(ALL('Table'),'Table'[ACT_END_DATE]=_maxend),[TASK_ID],"-")
return
IF(
    _countend=_countname,"Job complete",
IF(
   CONTAINSSTRING(
    _maxid,MAX('Table'[TASK PREDECESSOR]))=TRUE()&&MAX('Table'[TASK PREDECESSOR])<>BLANK(),
"current activity", BLANK()))

I didn't use "switch", but it work in my situation.

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors