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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.