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! Learn more

Reply
Anonymous
Not applicable

Filtering Data

Hi

This is my current data: 

ClientServiceStart DateEnd Date
120A01/04/201420/02/2017
125B01/04/201413/06/2014
125B22/10/2021 
126C01/04/201420/07/2016
127D01/04/2014 
128E01/04/2014 
129F19/04/202131/05/2021
130G01/04/201431/03/2021
130G01/04/2021 
132I01/04/2014 
133J01/04/201426/03/2017
134K01/04/2014 
135L01/04/201425/03/2019
135L26/03/2019 
136M01/04/201422/11/2016
136M23/11/201619/12/2016
136M20/12/201607/03/2017

I needed the outcome to be as the below table to calculate the Average number of dates a service took to close:

 

Average Number of dates by Unique client ID

 

ClientServiceStart DateEnd DateDATEDIF
120A01/04/201420/02/20171056
126C01/04/201420/07/2016841
129F19/04/202131/05/202142
133J01/04/201426/03/20171090
136M01/04/201422/11/2016966
136M23/11/201619/12/201626
136M20/12/201607/03/201777

 

thanks

 

 

 

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

Hi @Anonymous 

 

Please try:

First create a measure to filter the table:

Flag =

var _t = SUMMARIZE(FILTER(ALL('Table'),[Service]=MAX('Table'[Service])),'Table'[End Date])

RETURN IF(BLANK()in _t,0,1)

Then apply it to the filter:

vjianbolimsft_0-1658140688790.png

 

Create datediff:

datediff = DATEDIFF(MAX('Table'[Start Date]),MAX('Table'[End Date]),DAY)

Final output:

vjianbolimsft_1-1658140688793.png

 

Best Regards,

Jianbo Li

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
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous 

 

Please try:

First create a measure to filter the table:

Flag =

var _t = SUMMARIZE(FILTER(ALL('Table'),[Service]=MAX('Table'[Service])),'Table'[End Date])

RETURN IF(BLANK()in _t,0,1)

Then apply it to the filter:

vjianbolimsft_0-1658140688790.png

 

Create datediff:

datediff = DATEDIFF(MAX('Table'[Start Date]),MAX('Table'[End Date]),DAY)

Final output:

vjianbolimsft_1-1658140688793.png

 

Best Regards,

Jianbo Li

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

Anonymous
Not applicable

Sorry for the late reply but I just got back into this and it did work!

thank you ver much!

amitchandak
Super User
Super User

@Anonymous ,

Try a measure

 

measure =

var _1 = countx(filter(allselected(Table) , Table[ID] = max(Table[ID]) && isblank(Table[end date])), Table[ID] )
return
Averagex(filter(values(Table[ID), isblank(_1) ), datediff(Min(Table[Start Date]), Max(Table[End Date]), Day) )

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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