cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Daniela_Romasko
Frequent Visitor

Distinct Count de coluna virtual

Olá,
Estou tentando calcular quantar vezes o produto foi separado para identificar o esforço da logistica, para isso preciso calcular quantos itens distintos da coluna @NFprod da tabela virtual vNFprod. Porém a fórmula DISTINCTCOUNT retorna erro quando uso essa coluna. 

 

Pode me ajudar? 

 

  NFprod.PNG

 

Obrigada!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Daniela_Romasko 
Please try

NFprod =
VAR uNFprod =
    ADDCOLUMNS (
        ALLSELECTED ( TB_FATORAMENTO[N NOTA], TB_FATORAMENTO[CODIGO PRODUCTO] ),
        "@NFprod",
            [N NOTA] & "|" & [CODIGO PRODUCTO]
    )
RETURN
    COUNTROWS ( GROUPBY ( uNFprod, [@NFprod] ) )

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Daniela_Romasko 
Please try

NFprod =
VAR uNFprod =
    ADDCOLUMNS (
        ALLSELECTED ( TB_FATORAMENTO[N NOTA], TB_FATORAMENTO[CODIGO PRODUCTO] ),
        "@NFprod",
            [N NOTA] & "|" & [CODIGO PRODUCTO]
    )
RETURN
    COUNTROWS ( GROUPBY ( uNFprod, [@NFprod] ) )

Helpful resources

Announcements
Exciting changes

Power BI Community Changes

Check out the changes to the Power BI Community announced at Build.

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Kudo Data Story carousel

Data Stories Gallery

Visit our Data Stories Gallery and give kudos to your favorite Data Stories.

Top Solution Authors