Forum Discussion
Calculating Median based on unique IDs
I am trying to calculate the median of the revenue grouped by each individual product id. (i.e. median of product id 1, median of product id 2 etc) but currently I having issues doing that.
Example Data set below
Currently, I tried doing MEDIANX ('Product Table', 'Product Table'[Revenue] *1.0) which gave me just the median of the whole set, disregarding the different product ids.
I also tried doing MEDIANX (VALUES ('Product Table'[Product ID]), ( 'Product Table'[Revenue] *1.0) which just return the exact same value of the revenue column.
6 Replies
- Greg_Deckler
Community Champion
pingu24 Try:
Median by Product ID = VAR __ProductID = MAX( 'Table'[Product ID] ) VAR __Table = FILTER( ALL( 'Table' ), [Product ID] = __ProductID ) VAR __Result = MEDIANX( __Table, [Revenue] ) RETURN __Result - ArwaAldoud
Super User
Hi pingu24
Median_Revenue_Per_Product =
CALCULATE(
MEDIAN('Table'[Revenue]),
ALLEXCEPT('Table', 'Table'[Product ID])
)If this response was helpful, please accept it as a solution and give kudos to support other community members
- Ashish_Mathur
Super User
Hi,
Based on the data that you have shared, show the expected result. Share data in a format that can be pasted in an MS Excel file.
- v-aatheeque
Community Support
Hi pingu24
Has your issue been resolved? If a community member's response addressed your query, please consider marking it as Accepted Answer and click Yes if you found it helpful.
If you have any further questions, feel free to reach out.
Thank you for being a valued member of the Microsoft Fabric Community Forum!- v-aatheeque
Community Support
Hi pingu24
We haven’t heard back from you regarding our previous response and wanted to check if your issue has been resolved.
If it has, please consider clicking “Accept Answer” and “Yes” if you found the response helpful.
If you still have any questions or need further assistance, feel free to let us know — we're happy to help!Thank you!
- v-aatheeque
Community Support
Hi pingu24
Have you resolved the issue? If yes, kindly mark the helpful answer as a solution if you feel that makes sense. Welcome to share your own solution. More people will benefit from the thread.
Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!