Forum Discussion
Problems how many order by category
I have some problems with how many Order by category
hi, mmunozi1984
i think there are some confusion
let's break your code and try to know what output isso
ADDCOLUMNS(SUMMARIZE('Categorias',Categorias[NombreCategoria]),"pedidos",CALCULATE(COUNTROWS(RELATEDTABLE('Detalles de pedidos'))))give output like below (i am calculate new table )it give you a table which contain 8 rows (distinct value of NombreCategoria)
and count of related rows from table Detalles de pedidos.
these same answer given by my formula
in below code
COUNTROWS(FILTER([Pedidos] > 0))an you try to count rows of above table(in above image)
which contain 8 distinct rows of NombreCategoria (not rows present in table Detalles de pedidos)
so it give 1 value in NombreCategoria and total 8 (because 8 rows present in above table).
you use [Pedidos] > 0 but no value(count) below zero
I hope you clear what i want to sayIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly. and don't forget to give kudos.
Hi, mmunozi1984
i hope you understand what i try to explain
and now your desired output is belowresult =var a = CALCULATE(COUNTROWS(Pedidos),RELATEDTABLE('Detalles de pedidos'))return adownload .pbix file HERE
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. and don't forget to give kudos.
5 Replies
- Dangar332
Resident Rockstar
hi, mmunozi1984
try below
result = calculate(countrows('detalles de pedidos'), relatedtable('detalles de pedidos'))- mmunozi1984Frequent Visitor
I appreciate your efforts to assist me. However, it seems that it’s not functioning as expected. I’m aware that the total order amounts to 830. Therefore, the value of each category should be less than this figure. I show that the delivered measure turns out . I appreciate any help in advance.
My model data
https://drive.google.com/file/d/1tnZvCo8tAebXt7Zqgg0oPL7oLbGTMbnS/view?usp=share_link
- Dangar332
Resident Rockstar
hi, mmunozi1984
i think there are some confusion
let's break your code and try to know what output isso
ADDCOLUMNS(SUMMARIZE('Categorias',Categorias[NombreCategoria]),"pedidos",CALCULATE(COUNTROWS(RELATEDTABLE('Detalles de pedidos'))))give output like below (i am calculate new table )it give you a table which contain 8 rows (distinct value of NombreCategoria)
and count of related rows from table Detalles de pedidos.
these same answer given by my formula
in below code
COUNTROWS(FILTER([Pedidos] > 0))an you try to count rows of above table(in above image)
which contain 8 distinct rows of NombreCategoria (not rows present in table Detalles de pedidos)
so it give 1 value in NombreCategoria and total 8 (because 8 rows present in above table).
you use [Pedidos] > 0 but no value(count) below zero
I hope you clear what i want to sayIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly. and don't forget to give kudos.
- mmunozi1984Frequent Visitor
I realized my mistake, your solution is correct.