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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
deizesilveira
New Member

Transform DAX measure into data segmentation

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!

1 REPLY 1
lbendlin
Super User
Super User

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.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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