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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
carmen_romero
Regular Visitor

Except and sum filtered columns

Hi!

 

I have the next problem and my table looks like this one:

 

Captura2.PNG

 

I need generate a measure that filter col1 by some value of Col2, Col2 == Field2 for example, and Col3 by Col2==Field1, then I want to do a except between Col1 and Col3, and finally Sum the number of distinct rows by Col1. This will be my measure, is it possible to do this?

 

Thx.

1 ACCEPTED SOLUTION

Hi , @carmen_romero 

Here is  a demo.

pbix attached 

If help , try steps as below.

1.create  two Separation table as slicer

Measure 1 = CALCULATE(DISTINCTCOUNT('Table'[Col3]),FILTER('Table','Table'[Col2]="FieldB1"))
Measure 2 = CALCULATE(DISTINCTCOUNT('Table'[Col1]),FILTER('Table','Table'[Col2]="FieldB1"))

 

2.create measure "measure value" as below and  put it into card visual

measure value =
VAR t1 =
    CALCULATETABLE (
        DISTINCT ( 'Table'[Col1] ),
        FILTER ( 'Table', 'Table'[Col2] IN DISTINCT ( 'Slicer table 1'[Slicer1] ) )
    )
VAR t2 =
    CALCULATETABLE (
        DISTINCT ( 'Table'[Col3] ),
        FILTER ( 'Table', 'Table'[Col2] IN DISTINCT ( 'Slicer table2'[Slicer2] ) )
    )
RETURN
    SUMX ( t1, IF ( [Col1] IN t2, 1, 0 ) )

 

Best Regards,
Community Support Team _ Eason
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

3 REPLIES 3
az38
Community Champion
Community Champion

@carmen_romero 

based on your data example what result do you expect?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi! thx for your response!

 

Captura3.PNG

 

I need to follow this steps:

 

1 - Filter Col1 by value of Col2 in this case Col2 == FieldB1

2 - Filter Col3 by value of Col2 in this case Col2 == FieldB3

3- Select from result of step 1 the Col1 and the step 2 the Col3

4 - Do a except between values of both columns: Col1 except Col3

5 - Count distinct values for the except in the Col1

 

Thx!

Hi , @carmen_romero 

Here is  a demo.

pbix attached 

If help , try steps as below.

1.create  two Separation table as slicer

Measure 1 = CALCULATE(DISTINCTCOUNT('Table'[Col3]),FILTER('Table','Table'[Col2]="FieldB1"))
Measure 2 = CALCULATE(DISTINCTCOUNT('Table'[Col1]),FILTER('Table','Table'[Col2]="FieldB1"))

 

2.create measure "measure value" as below and  put it into card visual

measure value =
VAR t1 =
    CALCULATETABLE (
        DISTINCT ( 'Table'[Col1] ),
        FILTER ( 'Table', 'Table'[Col2] IN DISTINCT ( 'Slicer table 1'[Slicer1] ) )
    )
VAR t2 =
    CALCULATETABLE (
        DISTINCT ( 'Table'[Col3] ),
        FILTER ( 'Table', 'Table'[Col2] IN DISTINCT ( 'Slicer table2'[Slicer2] ) )
    )
RETURN
    SUMX ( t1, IF ( [Col1] IN t2, 1, 0 ) )

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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