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

View all the Fabric Data Days sessions on demand. View schedule

Reply
jeyare
Helper II
Helper II

Measure: Median of value evaluated within day

Hi there,

I have a problem finding a solution how to (in Measure) Calculate a Daily MEDIAN for values, based on this setup:

- I have column DATE (date)

- I have column FAILURES (Integer)

- I have column SERIAL_NO (String)

where

One day from the DATE has several failures generated by the SERIAL_NO .... then I have in the DATE column several same dates for each the Failures.

 

I can calculate MEDIAN for Non-zero or Non-blank values from the FAILURES:

 

CALCULATE(
MEDIAN('Table'[failure]),'Table'[failure]<>0||'Table'[failure]<>BLANK()))

 

 

thx for a help

1 ACCEPTED SOLUTION

I've got it:

First - for the SUM o ailures per day:

CALCULATE(
SUM('Table'[failure]),
FILTER(
ALL('Table') ,
'Table'[date] = EARLIER('Table'[date])
)
)
 
Then, next step:
CALCULATE(
MEDIAN('Table'[SUM o ailures per day]),'Table'[SUM o ailures per day]<>0||'Table'[SUM o ailures per day]<>BLANK()))

View solution in original post

6 REPLIES 6
jppv20
Solution Sage
Solution Sage

Hi @jeyare ,

 

Can you give an example of the desired output you require?

 

Jori

Hi @jppv20 ,

 

the example is attached in my screenshot from XLS.

Let start from a scratch:

- I have column DATE (date)

- I have column FAILURES (Integer)

 

jeyare_0-1633512812123.png

 

What I need:

  1. I need to Calculate how many failures happened on each particular day. For this purpose, I need to create a new column, for example "Sum of failures for the same date". This column will create similar to XLS: COUNTIFS(range of "date", same "date" in the row, range of "failures",1)
  2. Then I need to create New Measure that will create the MEDIAN (defined by my script + tuned by you.

I hope, it is more clear.

 

Jan

 

I've got it:

First - for the SUM o ailures per day:

CALCULATE(
SUM('Table'[failure]),
FILTER(
ALL('Table') ,
'Table'[date] = EARLIER('Table'[date])
)
)
 
Then, next step:
CALCULATE(
MEDIAN('Table'[SUM o ailures per day]),'Table'[SUM o ailures per day]<>0||'Table'[SUM o ailures per day]<>BLANK()))

Hi @jeyare ,

 

Think I understand better now. You can create the calculated column with the following formula:

failures/day = CALCULATE(SUM(Failures[failures]),ALLEXCEPT(Failures,Failures[date]))
jppv20_0-1633514188097.png

 

After that you can create the measure:

Median = MEDIAN(Failures[failures/day])
 
Hope this helps!
 

Jori

 

If I answered your question, please mark it as a solution to help other members find it more quickly.

Connect on Linkedin

jppv20
Solution Sage
Solution Sage

Hi @jeyare ,

 

Try this:

CALCULATE(
MEDIAN('Table'[failure]),'Table'[failure]<>0||'Table'[failure]<>BLANK(),ALLEXCEPT('Table','Table'[date]))

 

Jori

 

If I answered your question, please mark it as a solution to help other members find it more quickly.

Thank you @jppv20 ,

 

maybe I was wrong in my description. Here is better situation scope:

 

jeyare_0-1633439934232.png

 

Maybe I need to create a New Column: Sum of failures for the same date

here I need to Calculate Sum of Failures per each day separately (follow the table),

then I can Calculate the Median from the New Column.

I will appreciate a help. 

Thx

 

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