Forum Discussion

luciano1903's avatar
luciano1903
Frequent Visitor
2 years ago
Solved

Contagem veículos e clientes

Pessoal bom dia!

Tenho uma situação, em que preciso saber a quantidade de veículo e volume carregado em cada cliente. Porem as vezes 1 veiculo carrega 5 CRTs, nao relatório fincando 5 linhas(CRTs diferentes). Cada CRT é um exportador/Cliente.

Preciso criar uma medida para cada situacao, para saber a quantidade de veiculo e volume de veiculos carregado em cada cliente, notar que a mesma placa carrega em lugares diferentes.

Segue exemplo:

 

 

Desde ja agradeco pela ajuda.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi luciano1903 ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) This is my test data. 

    (2) We can create measures.

    the number of vehicles =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[VEICULO] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[CLIENTE] = MAX ( 'Table'[CLIENTE] ) )
    )
    
    the volume of vehicles loaded at each customer =
    COUNTROWS (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[CLIENTE] = MAX ( 'Table'[CLIENTE] ) )
    )
    

    (3) Then the result is as follows.

    Best Regards,

    Neeko Tang

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi luciano1903 ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) This is my test data. 

    (2) We can create measures.

    the number of vehicles =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[VEICULO] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[CLIENTE] = MAX ( 'Table'[CLIENTE] ) )
    )
    
    the volume of vehicles loaded at each customer =
    COUNTROWS (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[CLIENTE] = MAX ( 'Table'[CLIENTE] ) )
    )
    

    (3) Then the result is as follows.

    Best Regards,

    Neeko Tang

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