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
Syndicate_Admin
Administrator
Administrator

Calculate median from calculated column

Hello, good afternoon

I have the following calculated table

Yeztrom_0-1651266928559.png

This table corresponds to the calculation of a fashion however when it is the case that it has more than one fashion I need to calculate the median to stay with a single value.

The table above is calculated with this measurement:

WHERE _VW_Prices_Mode =
FILTER(
_VW_Prices_Mode_Retalers_No_Model,
[Year_Week| Max_Rep] IN _VW_Prices_List_Year_Weeek_and_Max_Rep
)
Try to use the following measure:
VAR _VW_Prices_Mode_Clear =
SUMMARIZE(
_VW_Prices_Mode,
[master_product_id],
[related year_week],
"Mode",MEDIANX(_VW_Prices_Mode,[product_current_price])
)
However in the field that corresponds to fashion that in this case would be the mendiana (....) throws me the following result
Yeztrom_1-1651267333819.png

This result is incorrect, I had thought to use the groupby function but it seems to me that it is not compatible with the MEDIANX function.

I would like to know if there is any way to do this.

I thank you in advance.

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

After searching the internet I could make the solution which is as follows:

WHERE _VW_Prices_Mode_Clear =
SUMMARIZE(
_VW_Prices_Mode,
[master_product_id],
[related year_week],
"Mode",MEDIANX(FILTER(_VW_Prices_Mode, [master_product_id] = EARLIER([master_product_id]) && [related year_week] = EARLIER([related year_week]) ), [product_current_price])
)

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

After searching the internet I could make the solution which is as follows:

WHERE _VW_Prices_Mode_Clear =
SUMMARIZE(
_VW_Prices_Mode,
[master_product_id],
[related year_week],
"Mode",MEDIANX(FILTER(_VW_Prices_Mode, [master_product_id] = EARLIER([master_product_id]) && [related year_week] = EARLIER([related year_week]) ), [product_current_price])
)
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

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