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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Median revenue

Currently, I have the average revenue made on my dashboard.  I would also like to make the median revenue too.

 

Problem is, I want the median revenue of the sum of each patient.

I want to sum up each patients revenue.... and then take the median of those sums.  How do I go about that?

 

currently these are my codes:

AvgRevenue Per Patient = [Revenue] / 'Fewer Discounts'[Count of Invoices]
Count of Invoices = DISTINCTCOUNT('public view_transactions'[invoice_key])
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @Anonymous,

You can create a variable table with summarize function to group based on current categories and summary these values, then you can use the iterator 'median' function to get the median number from this variable table records.

If you confuse about coding formula, please share some dummy data to test.

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @Anonymous,

You can create a variable table with summarize function to group based on current categories and summary these values, then you can use the iterator 'median' function to get the median number from this variable table records.

If you confuse about coding formula, please share some dummy data to test.

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
DataInsights
Super User
Super User

@Anonymous,

 

Try these measures. I created a Patients table with one row per patient, with a relationship to the data table (star schema).

 

Sum Revenue = SUM ( Revenue[Revenue] )

Median Revenue = 
VAR vTable =
    ADDCOLUMNS ( VALUES ( Patients[Patient ID] ), "@SumRevenue", [Sum Revenue] )
VAR vResult =
    MEDIANX ( vTable, [@SumRevenue] )
RETURN
    vResult

 

Sample data:

 

DataInsights_1-1619186277953.png

 

 

Result:

 

DataInsights_0-1619186268761.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




MFelix
Super User
Super User

HI @Anonymous ,

 

For this type of calculations you need to use the aggregated syntax that are the ones that end with an X in this case you need to use MEDIANX should look similar to something similar to this:

 

 

MEDIANX(Values[Table[PatientID]), [Revenue])  

 

 

Be aware that this is only a mockup you may need to change the first parameter that is the table part.

 

https://dax.guide/medianx/

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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