Forum Discussion
CANTIDAD DE LOCALES
Buenas tardes estimados
Tengo una tabla con 30 locales, articulo y total de venta
Yo necesito una fórmula que cuando selecciono un artículo me diga cuantos locales lo vendieron
Puedo hacerlo con un recuento distintivo pero necesito una fórmula porque ese dato luego lo voy a dividir por otros datos
Ejemplo: selecciono articulo mesa y que me diga cuantos locales vendieron esa mesa
Gracias
Hi YOSIEMPREYO12 ,
You can make use of SUMX function here which will count stores that sold the article, and then sums it properly across months.Assuming you have a date table and your model is correctly related.
StoresSoldPerMonth =
SUMX(
VALUES('Date'[Month]),
CALCULATE(
DISTINCTCOUNT(Sales[Store]),
Sales[TotalSale] > 0
)
)
Hope this helps!
If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
6 Replies
- lbendlin
Super User
Create another reference table that lists all articles. Keep that table disconnected from the data model. Then create a measure that calculates your desired result based on the selected value of that article list.
- YOSIEMPREYO12Frequent Visitor
pero necesito que los filtros funcionen. Conseguí hacerlo con distinctcount el problema ahora es que si elijo solo un mes me trae el dato correcto. Pero si elijo 2 me lo trae mal.
osea, Marzo 10 locales, Abril 4 locales, si los elijo a ambos me dice 11 porque busca los locales diferentes pero preciso el total por mes
- YOSIEMPREYO12Frequent Visitor
- v-sdhruv
Community Support
Hi YOSIEMPREYO12 ,
You can make use of SUMX function here which will count stores that sold the article, and then sums it properly across months.Assuming you have a date table and your model is correctly related.
StoresSoldPerMonth =
SUMX(
VALUES('Date'[Month]),
CALCULATE(
DISTINCTCOUNT(Sales[Store]),
Sales[TotalSale] > 0
)
)
Hope this helps!
If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.- YOSIEMPREYO12Frequent Visitor
Si funcióna!!
Gracias
- lbendlin
Super User
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523