cancel
Showing results for
Did you mean:
New Member

## Display median by day of week

Hello, I am a new user of Power BI Deskop.  I face a relatively simple problem but I can't find an obvious solution...

I have a data set (see example below) with which I want to calculate the median number of entrance per day of the week.

When I make my graphs, the median is not correct because it calculates the values only between 1 and 0.

What is the best solution? Should I create different calculated tables with aggregated value by day of the week? should I make a  measure with a DAX formula?

I have tried to use the "summarize" function without success. I also tried to creat a calulated table with the "group by" function but I am afraid that it will not be efficient when I have very large data sets. Thanks a lot for your help!

 Date Day_of_week No.patient Service Entrance 03.01.2022 1 1001 ORT 1 03.01.2022 1 1002 CHIR 1 03.01.2022 1 1003 ORT 0 03.01.2022 1 1004 CHIR 0 04.01.2022 2 1005 MED 1 04.01.2022 2 1006 MED 1 04.01.2022 2 1007 URG 1 05.01.2022 3 1008 URG 0 05.01.2022 3 1009 ORT 1 05.01.2022 3 1010 GASTRO 1 05.01.2022 3 1011 GASTRO 1 06.01.2022 4 1012 ORT 0 06.01.2022 4 1013 URG 1 06.01.2022 4 1014 ORT 1 06.01.2022 4 1015 CHIR 1 06.01.2022 4 1016 ORT 0 06.01.2022 4 1017 CHIR 0 07.01.2022 5 1018 MED 1 07.01.2022 5 1019 MED 1 07.01.2022 5 1020 URG 1 07.01.2022 5 1021 URG 0 07.01.2022 5 1022 ORT 1 08.01.2022 6 1023 GASTRO 1 08.01.2022 6 1024 GASTRO 1
3 REPLIES 3
Community Support

Has your problem been solved? If so, would you like to accept the helpful solution.

If not, could you please show the expected output.

Best Regards,
Community Support Team _ kalyj

Super User

lo

Try this

TEST MEDIAN = calculate(median('MEDIAN'[Entrance]),ALLEXCEPT('MEDIAN','MEDIAN'[Day_of_week]))

Super User

There's a built-in function for that - MEDIANX() - have you tried that?

Announcements

#### CollabDays Lisbon - 26 November 2022

Sessions include practical, hands-on experience that will help you take the next step in your career and know-how.

#### Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

#### European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

#### Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors