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
GunnerJ
Post Patron
Post Patron

AddColumns where a condition is met

I have a summary table that calculates the difference between a min and max date. I'd like to modify it to only show data where the "Min Date" is the earliest record with a work group = "Service". If no "service" work group is present then filter out the data. If it is present make the earliest BI_EVENT_DT_TM with service be the Min date and leave the max date as it is. 
 This data set would be excludedThis data set would be excludedThis data set would be included and min date would be the row with Service as the workgroup.This data set would be included and min date would be the row with Service as the workgroup.
 
SummaryTable =
ADDCOLUMNS(
SUMMARIZE(
Workflow,
Workflow[BI_SO_NBR],
Workflow[BI_TASK_CD],
Workflow[BI_WRKFLW_TASK_SEQ_NBR],
Workflow[BI_WORK_EVENT_CD],
"Min Time",MIN (Workflow[BI_EVENT_DT_TM]),
"Max Time",MAX (Workflow[BI_EVENT_DT_TM])
),
"Time Sec", DATEDIFF([Min Time],[Max Time],SECOND),
"Time HR", DATEDIFF([Min Time],[Max Time],HOUR)
)
2 REPLIES 2
dax
Community Support
Community Support

Hi GunnerJ

According to your description, it seems that you want to show only data with “service ” group, right? If so, think you could use below expression to create new table (replace Table1[type]="c"|| Table1[type]="a" with your condition)

Table =
ADDCOLUMNS (
    SUMMARIZE (
        FILTER ( Table1, Table1[type] = "c" || Table1[type] = "a" ),
        Table1[id],
        Table1[type],
        "mind", MIN ( Table1[date] ),
        "maxd", MAX ( Table1[date] )
    ),
    "datediff", DATEDIFF ( [mind], [maxd], DAY )
)

37.png

Best Regards,

Zoe Zhi

 

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

@dax specifically I'm wanting just the "Min Time" date to filter down to the work group "Service". Sequences often end with tasks that don't have a specific workgroup so I'm just trying to find the different between the first task of workgroup = Service and the max date.

 

SummaryTable =
ADDCOLUMNS(
SUMMARIZE(
Workflow,
Workflow[BI_SO_NBR],
Workflow[BI_TASK_CD],
Workflow[BI_WRKFLW_TASK_SEQ_NBR],
Workflow[BI_WORK_EVENT_CD],
Workflow[BI_WORKGRP3],
"Min Time",MIN (Workflow[BI_EVENT_DT_TM]),
"Max Time",MAX (Workflow[BI_EVENT_DT_TM])
),
"Time Sec", DATEDIFF([Min Time],[Max Time],SECOND),
"Time HR", DATEDIFF([Min Time],[Max Time],HOUR)
)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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