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
stiggy771
Frequent Visitor

Finding an overall median of a measure by week in table and chart visual

I have the following visual that shows the week by week shipping cost for a department. The [Cost per shipment] is a measure and I would like to take the median of this measure and bring it into the visual as well as a line chart. Is there a way to do this?

Week_Num is from a Calendar_Table

Table visual 

WEEK_NUMCost per shipmentMedian of Weekly Cost per Shipment
1$7.41$9.05
2$9.47$9.05
3$7.83$9.05
4$9.05$9.05
5$9.21$9.05
6$7.91$9.05
7$10.19$9.05
8$8.57$9.05
9$8.13$9.05
10$9.27$9.05
11$9.90$9.05
12$6.67$9.05
13$9.99$9.05

 

Line Chart

stiggy771_0-1685630196640.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Median of Weekly Cost per Shipment = MEDIANX(VALUES(Calendar_Table[Week_Num]),[Cost per shipment])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Median of Weekly Cost per Shipment = MEDIANX(VALUES(Calendar_Table[Week_Num]),[Cost per shipment])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

You cannot measure a measure.,  Implement your entire business logic in the new measure, Use virtual table variables for the  intermediate steps.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Appreciate the response. So my issue here is that I have multiple measures that I have created using a bunch of tables. A lot of these measures are using sources from different tables, for instance cost per shipment uses overall cost from a finance database for actuals and shipments count of product from another table for outbound data.

The ask from execs is that for some of these measures, that are being tracked week over week, they'd like to see a target line in the charts that is based on the median of that measure, for the current period in the chart, usually 6 week rolling.  Easy to do in excel but no idea how to go about it in power bi. I thought a simple table (the table above is not a screenshot, the chart is) could get my problem across. 

You sample presents a static table. Measures behave differently, they are recalculated every time. That means your sample data in its current form is not covering your scenario.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.