cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cobra77 Member
Member

Filter in variable KO

Hi

We wants to know the number of duplicates 

 

Nb Duplicates =
VAR tabgrp =
SUMMARIZECOLUMNS (
'Client'[Nom];
Client[Prénom];
Client[Date_naissance];
"nb"; DISTINCTCOUNT ( Client[Id_Origin] ) )

VAR f = FILTER(tabgrp;[nb]> 1)

RETURN CALCULATE(COUNTROWS(tabgrp);f)

 

But f = FILTER(tabgrp;[nb]> 1)  don t work

 

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Filter in variable KO

Hi @Cobra77 ,

Try this small modification. Bear in mind that variables in DAX are immutable once they've been assigned a value at declaration. Therefore, tabgrp will not be affected by the filter argument in CALCULATE(COUNTROWS(tabgrp); f)

Nb Duplicates =
VAR tabgrp =
    SUMMARIZECOLUMNS (
        'Client'[Nom];
        Client[Prénom];
        Client[Date_naissance];
        "nb"; DISTINCTCOUNT ( Client[Id_Origin] )
    )
VAR f =
    FILTER ( tabgrp; [nb] > 1 )
RETURN
    COUNTROWS ( f )

 

View solution in original post

1 REPLY 1
Highlighted
Super User
Super User

Re: Filter in variable KO

Hi @Cobra77 ,

Try this small modification. Bear in mind that variables in DAX are immutable once they've been assigned a value at declaration. Therefore, tabgrp will not be affected by the filter argument in CALCULATE(COUNTROWS(tabgrp); f)

Nb Duplicates =
VAR tabgrp =
    SUMMARIZECOLUMNS (
        'Client'[Nom];
        Client[Prénom];
        Client[Date_naissance];
        "nb"; DISTINCTCOUNT ( Client[Id_Origin] )
    )
VAR f =
    FILTER ( tabgrp; [nb] > 1 )
RETURN
    COUNTROWS ( f )

 

View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 60 members 1,234 guests
Please welcome our newest community members: