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

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

Reply
Syndicate_Admin
Administrator
Administrator

Calculate mode from a data table

Nice day.

I have a historical data table with which I have calculated the average and median but I lack fashion. I've been searching different forums and haven't found the solution. I would be very grateful for your recommendations.

Attached part of the table that is required to calculate the time mode for each sub activity:

SUB ACTIVITYTIME
Contracts, agreements and legal documents0:10:00
Contracts, agreements and legal documents0:10:00
Meeting with supplier0:15:00
Payment process0:15:00
Quote0:15:00
Payment process0:15:00
Review and filling of WBS, requisitions0:15:00
Contracts, agreements and legal documents0:15:00
Quote0:15:00
Contracts, agreements and legal documents0:30:00
Contracts, agreements and legal documents0:30:00
Purchase Order0:30:00
Quote0:30:00
Validation and specification0:30:00
Modify Ms Project program1:15:00
Ms Project Program Review / Activities1:30:00
Ms Project Program Review3:30:00
Design/draw/model5:40:00
Purchase Order0:15:00
Purchase Order0:15:00
Purchase Order0:15:00
Guarantees0:15:00
Guarantees0:15:00
Validation and specification0:15:00
Purchase Order0:20:00
Purchase Order0:20:00
Purchase Order0:20:00
Payment process0:30:00
Comparative0:45:00
Validation and specification0:45:00
Validation and specification0:45:00
Updating indicators1:00:00
Validation and specification1:30:00
Quote1:30:00
Updating indicators1:30:00
Ms Project Program Review2:45:00
Ms Project Program Review3:00:00
Printing/Folding Drawings4:00:00
Plano as-built4:00:00
Architectural program and zoning8:00:00
Design/draw/model8:00:00
Quantification/Catalog/WBS8:00:00
Design/draw/model9:00:00
Design/draw/model9:00:00
Quote0:15:00
Contracts, agreements and legal documents0:15:00
Purchase Order0:15:00
Purchase Order0:15:00
Purchase Order0:15:00
Payment process0:15:00
Job closure0:20:00
Job closure0:25:00
Quote0:25:00
Quote0:25:00
Payment process0:30:00
Comparative0:30:00
Quote0:30:00
Contracts, agreements and legal documents0:35:00
Comparative0:40:00
Validation and specification0:45:00
Contracts, agreements and legal documents0:45:00
Quote1:00:00
Validation and specification1:00:00
Construction route1:00:00
CONSTRUCTION SUPERVISION2:00:00
Development of generators and volumetries2:00:00
ELABORATION OF MATERIAL REQUIREMENTS2:00:00
Site visit2:00:00
Purchase tracking2:00:00
DELIVERY TO OPERATION3:00:00
Printing/Folding Drawings3:00:00
DELIVERY TO OPERATION5:00:00
Project request (interiors/engineering)5:00:00
Design/draw/model5:00:00
Design bases/criteria5:00:00
Design/draw/model7:00:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Review and filling of WBS, requisitions0:05:00
Quote0:10:00
Quote0:10:00
Quote0:10:00
Quote0:10:00

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Syndicate_Admin 

You just can remove the column I have put in measure, than the output is correct

vxinruzhumsft_0-1673601112603.png

Best Regards!

Yolo Zhu

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

6 REPLIES 6
Syndicate_Admin
Administrator
Administrator

As a complement to the help I require, it is like having a table with the following data:

NationalityAge
Mexico25
Mexico15
Mexico30
Mexico30
Mexico20
Colombia22
Colombia35
Colombia40
Colombia40
Colombia50
Argentina18
Argentina21
Argentina45
Argentina45
Argentina33
Canada16
Canada22
Canada28
Canada28
Canada34

And that as a result the following summary table:

NationalityFashion (age)
Mexico30
Colombia40
Argentina45
Canada28
Anonymous
Not applicable

Hi @Syndicate_Admin 

 the following is my sample,

1.  create a new column to transfer the time to minutes

Minutes_TIME = HOUR('Table'[TIME])*60+MINUTE('Table'[TIME])

2.Then create two measures: 

AVG_TIME = AVERAGEX(FILTER(ALL('Table'),[SUB ACTIVITY]=MAX('Table'[SUB ACTIVITY])),[Minutes_TIME]) 
MED_TIME = MEDIANX(FILTER(ALL('Table'),[SUB ACTIVITY]=MAX('Table'[SUB ACTIVITY])),[Minutes_TIME]) 

Output:

vxinruzhumsft_1-1672711227456.png

Best Regards!

Yolo Zhu

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

Thank you Yolo Zhu, I understand that this solution you propose gives as a response to the average and the median.

But the data I need is fashion, which is the value that is most repeated.

Best regards.

Anonymous
Not applicable

Hi @Syndicate_Admin 

You just can remove the column I have put in measure, than the output is correct

vxinruzhumsft_0-1673601112603.png

Best Regards!

Yolo Zhu

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

 

amitchandak
Super User
Super User

@Syndicate_Admin , Based on what I got. You have convert time to second or minute and take avg

seconds  = hour([Time])*3600 + minute([Time])*3600  + Second([Time])

 

You can use median or medianx

 

median measure= medianx(Table, Table[second])

 

if needed convert back to time

 

time(0,0,0) + [median measure]/3600*24

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

Thank you amitchandak, I understand that this solution you propose gives as an answer to the median.

But the data I need is fashion, which is the value that is most repeated.

Best regards.

Helpful resources

Announcements
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