Forum Discussion
Product_Date
- 4 years ago
Então apenas temos de alterar nossa medida para o SUMX em vez de ser o COUNTROWS:
PercentageConsecutive = VAR Sales_values = SUMMARIZE ( FILTER ( 'Table', 'Table'[Date] <= TODAY () && 'Table'[Date] >= TODAY () - 1 ), 'Table'[ProductID], "@CountSales", COUNT ( 'Table'[ProductID] ) ) RETURN DIVIDE ( SUMX ( FILTER ( Sales_values, [@CountSales] > 1 ) , [@CountSales]), SUMX ( Sales_values, [@CountSales] ) )Neste caso temos 2 linhas do artigo 4 sobre 5 linhas totais 2/5 = 40%
Caso tenhas uma coluna de quantidade e seja esse o valor que queres dividir terás que acrescentar essa coluna na variavel e depois utilizar como parametro do SUMX:
PercentageConsecutive = VAR Sales_values = SUMMARIZE ( FILTER ( 'Table', 'Table'[Date] <= TODAY () && 'Table'[Date] >= TODAY () - 1 ), 'Table'[ProductID], "@CountSales", COUNT ( 'Table'[ProductID] ), "@QuantitySales", SUM( 'Table'[Quantity] ), ) RETURN DIVIDE ( SUMX ( FILTER ( Sales_values, [@CountSales] > 1 ) , [@QuantitySales]), SUMX ( Sales_values, [@QuantitySales] ) )
MFelix Maybe you can help with the Portuguese please?
Vitor_sp_bo Are you only wanting the products with sales on consecutive days to be presented in the pie chart? or do you want a percentage of how many products have consecutive days' sales?
- Vitor_sp_bo4 years agoHelper I
Hello, I appreciate the response and I will pass the data requested below:
I need the percentage of items with sales in Today() and Today()-1, today and yesterday, this percentage would look like YES (Yes there was sale yesterday or today ) and those that do not meet the requirement would be as NO (There was no sale yesterday or today)- MFelix4 years agoSuper User
Boa tarde Vitor_sp_bo ,
Peço desculpa mas dada a informação que forneces no primeiro post não percebi muito bem o que se pretende. Dizes que o product_ID=4 tem dois passes no entanto as datas que aparecem são distintas e apenas uma vez em cada dia.
Pelo que posso perceber o que se pretende dizer é que existe 1 venda consecutiva em 8 vendas neste caso podes fazer o seguinte:
- Criar uma coluna calculada:
SalesConsecutive = COUNTROWS ( FILTER ( 'Table', 'Table'[Date] = EARLIER ( 'Table'[Date] ) - 1 && 'Table'[ProductID] = EARLIER ( 'Table'[ProductID] ) ) ) + 0Adicionar as seguintes duas medidas:
PercentageConsecutive = DIVIDE ( COUNTROWS ( FILTER ( 'Table', 'Table'[SalesConsecutive] = 1 ) ), COUNTROWS ( 'Table' ) ) Percentage Non Consecutive = 1 - [PercentageConsecutive]Utilizar as duas medidas para fazer o grafico:
AllisonKennedy thank you for the call.
- Vitor_sp_bo4 years agoHelper I
MFelix Cara, obrigado pela ajuda, em estrutura eu acredito que seja realmente isso, eu consigo fazer essa comparação levando em conta apenas hoje e ontem ? Exemplo: o ID 4 apareceu ontem e hoje( Today() e Today ()-1(Ai eu coloca como sim), um simples filtro bastaria ?