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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Spaik
Regular Visitor

Como exibir lista de clientes do mesmo segmento ao selecionar um filtro segmentado?

 

Estou tentando criar uma medida no Power BI para exibir uma lista de clientes que estão associados a um segmento específico, com base na seleção de um cliente em um slicer.

Estou usando a seguinte fórmula DAX:

 

ClientesDaMesmaSegmentacao = VAR ClienteSelecionado = SELECTEDVALUE('Table 23-24'[Nome Fantasia]) VAR SegmentacaoDoCliente = CALCULATE( MAX('Table 23-24'[SEGMENTO]), 'Table 23-24'[Nome Fantasia] = ClienteSelecionado ) RETURN CALCULATETABLE( SELECTCOLUMNS( FILTER( 'Table 23-24', 'Table 23-24'[SEGMENTO] = SegmentacaoDoCliente ), "Nome Cliente", 'Table 23-24'[Nome Fantasia] ) )
 

No entanto, a fórmula não está retornando todos os clientes do segmento, mas apenas um único cliente.

 

Alguém pode me ajudar a ajustar essa fórmula para que, ao selecionar um cliente, eu possa ver todos os clientes do mesmo segmento?

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Spaik ,

I created some data:

vyangliumsft_0-1727317717447.png

As far as I know, when the slicer and visual use the same field, when the slicer selects a value, the visual will also only show the data for the value selected by the slicer, and you will need to create a sliced table without a join relationship

Here are the steps you can follow:

1. Create calculated table – slicer table.

Table =
DISTINCT('Table 23-24'[Nome Fantasia])

2. Create measure.

Flag =
VAR ClienteSelecionado =
    SELECTEDVALUE ( 'Table'[Nome Fantasia])
VAR SegmentacaoDoCliente =
    CALCULATE (
        MAX ( 'Table 23-24'[SEGMENTO] ),
        'Table 23-24'[Nome Fantasia] = ClienteSelecionado
    )
VAR Test=
SELECTCOLUMNS(FILTER(ALL('Table 23-24'),'Table 23-24'[Nome Fantasia]=MAX('Table 23-24'[Nome Fantasia])),"Nome Cliente",[SEGMENTO])
RETURN
IF(
    SegmentacaoDoCliente in Test,1,0)

vyangliumsft_1-1727317717450.png

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1727317760398.png

4. Result:

vyangliumsft_3-1727317760401.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

Hi  @Spaik ,

I created some data:

vyangliumsft_0-1727317717447.png

As far as I know, when the slicer and visual use the same field, when the slicer selects a value, the visual will also only show the data for the value selected by the slicer, and you will need to create a sliced table without a join relationship

Here are the steps you can follow:

1. Create calculated table – slicer table.

Table =
DISTINCT('Table 23-24'[Nome Fantasia])

2. Create measure.

Flag =
VAR ClienteSelecionado =
    SELECTEDVALUE ( 'Table'[Nome Fantasia])
VAR SegmentacaoDoCliente =
    CALCULATE (
        MAX ( 'Table 23-24'[SEGMENTO] ),
        'Table 23-24'[Nome Fantasia] = ClienteSelecionado
    )
VAR Test=
SELECTCOLUMNS(FILTER(ALL('Table 23-24'),'Table 23-24'[Nome Fantasia]=MAX('Table 23-24'[Nome Fantasia])),"Nome Cliente",[SEGMENTO])
RETURN
IF(
    SegmentacaoDoCliente in Test,1,0)

vyangliumsft_1-1727317717450.png

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1727317760398.png

4. Result:

vyangliumsft_3-1727317760401.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.