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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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