Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a DAX measure that displays Customer Status as "Sem Crescimento", "Com Crescimento", "Sem Histórico", and "Sem Compra". Currently, this measure dynamically characterizes a customer based on their Gross Sales (through DAX) and does not exist as a characterization within a table.
I need a solution to transform this DAX measure into a slicer, where the user can select one of the 4 options in the filter and view in a table visual only the customers that match the status according to the selected filter.
Below is the DAX formula for Customer Status and the two Gross Sales measures that compose this measure:
Status Cliente =
VAR VendasAtual = [Venda Bruta]
VAR VendasAnterior = [Venda Bruta AA]
RETURN IF(ISBLANK(VendasAtual) = FALSE() && ISBLANK(VendasAnterior) = FALSE() && VendasAtual > VendasAnterior, "COM CRESCIMENTO", IF(VendasAtual = 0 && VendasAnterior > 0, "SEM COMPRA", IF(VendasAtual > 0 && VendasAnterior > 0 && VendasAtual < VendasAnterior, "SEM CRESCIMENTO", IF(VendasAnterior = 0 && VendasAtual > 0, "SEM HISTÓRICO", BLANK()))))
Venda Bruta =
CALCULATE( SUMX( FILTER( 'tabela_venda', 'tabela_venda'[ITEM_COM_RECUSA] = "Não"), 'tabela_venda'[VL_LIQUIDO] ) ) + CALCULATE( SUMX( FILTER( 'tabela_venda', 'tabela_venda'[ITEM_COM_RECUSA] = "Sim"), 'tabela_venda'[VL_CAN] ) )
Venda Bruta AnoAnterior =
VAR ColecaoAnterior = [Coleção Anterior]
RETURN CALCULATE([Venda Bruta], ALL(dim_chave[CHAVE_COMERCIAL]), dim_chave[CHAVE_COMERCIAL] = ColecaoAnterior )
Coleção Anterior =
VAR Atual = [Coleção Atual]
VAR Chave = LEFT(Atual, 2) VAR AnoAnterior = RIGHT(Atual, 4) - 1
RETURN Chave & " " & AnoAnterior
Coleção Atual = SELECTEDVALUE(dim_metas[CHAVE_COMERCIAL])
Thank you in advance for your help!
Power BI does not support that. You need to bring your own reference table with the expected category values, and then you can base your measure on that table.
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
13 | |
11 | |
9 | |
6 |