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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Define median of grouped and non-recurring data

Friends, how are you doing?

I have the following problem and I would like to have your help.

I have a base where you have the Id_cliente, the code of a product that the customer bought and the amount that he bought. In many cases the customer repeats the purchase of that product, although sometimes he does it with different quantities.

I am needing to determine the median of each product consumed (code), for which I first group it to the code per client so that it adds the total of each one, and then I apply the median. The problem I have with that function is that it only returns the median of those customers who had consumption, and if the client did not consume that product does not take it into account, when I should put value 0.

I share capture, to see if they understand a little more.

Base original

Base originalBase originalBase original

Product grouping by customer

Agrupando producto por cliente. Me calcula la mediana sobre esos valores.Agrupando producto por cliente. Me calcula la mediana sobre esos valores.Grouping product by customer. It calculates the median on those values.

Intended result

Formato que necesito.Formato que necesito.Format I need.

Can you think of a solution!?

M

7 REPLIES 7
Syndicate_Admin
Administrator
Administrator

Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.  Ensure that you already have the table/matrix there already.


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

Nice day. Attached the file

Archivo PBI

1.PNG

I need a table where if the product was not consumed put a 0, having that could determine the median correctly.

2.PNG

Thanks a lot!

Hi,

I get an error when i click on that link.


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

Back, I just checked that the previous one didn't go up. Thank you

PBI File

See if this measure works

Mediana_cantidad 1 = MEDIANX(generateall(values(Tabla_precio[Código]),values(Tabla_precio[PRECIO UNITARIO ÚLTIMA COMPRA])),min('Consulta_consumo'[Cantidad_]))

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

Attach back the link, to see if it can now be viewed

ArchivoPBI

Thanks a lot

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors