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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Median of Median on TimeSeries

Dear Community

I'm created a MEDIAN measure for salesPrice. 

 

ahau_1-1666257823597.png

 

As you can see on my screenshot, the blue line is the result I currently get.

But what I like to get is the Median based on the selected date range.

That would be 53.67 in my example, because this is the middle value (median) of this three numbers.

 

I tried the followning meaure but I don't work as expected.

 

Test_Medain =
Var Var_LastDate  = Max('Time'[DateKey])
Var Var_FirstDate = Min('Time'[DateKey])
Var x =
CALCULATE(
    MEDIAN(OrderLine[SalesPriceEUR])
    ,Filter(
         ALL('Time')
        ,AND('Time'[DateKey] >= Var_FirstDate ,
             'Time'[DateKey] <= Var_LastDate
        )
    )
)
Return (x)    

 

ahau_2-1666258123301.png

 

Any plans how I must modify my query?

Thx 

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

Please adjust the measure MyMedian to your needs. File attached.

View solution in original post

2 REPLIES 2
daXtreme
Solution Sage
Solution Sage

Please adjust the measure MyMedian to your needs. File attached.

Anonymous
Not applicable

This Statement works totally fine for me.
Many, many thanks.

Var SalesPrice = Sum(Sales[SalePrice])
Var v_X_Axis_SelectedTime = ISFILTERED('Time'[DateValue])
Var v_Result =
    IF(v_X_Axis_selectedTime,
        MEDIANX(
            ALLSELECTED('Time'),[SalesPrice]
        )
    )
Return
    v_Result

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.