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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SebaSpotti
Advocate II
Advocate II

Exclude part of the data in a measure for all the data except the part itself

Hi all!

 

I have a problem and I hope someone can help me.

I have a tabel with 3 columns "Group","Qestion", "Response" like this (and so on)

Group 1Q1_G11
Group 1Q1_G12
Group 1Q2_G13
Group 2Q1_G24
Group 3Q1_G38
Group 2Q1_G21
Group 2Q2_G310
Group 3Q2_G30

I have this measure: 

 

num_good = CALCULATE(
    COUNT('Table1'[Response]),
    FILTER('Table1','Table1'[Response]>=9))

 

I want to modify this measure in such a way that it continues to perform the same calculation excluding the 'Question' equal to 'Q1_G1' and that for the 'Question' 'Q1_G1' it excludes everything else. Is it possible?

 

Thanks all!

Seba

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @SebaSpotti 

Based on your description, I used the following example data:

vjianpengmsft_0-1739864895729.png

Create the following measure:

num_good = 
SUMX(
    VALUES('Table'[Qestion]),
    IF(
        'Table'[Qestion] = "Q1_G1",
        CALCULATE(
            COUNT('Table'[Response]),
            FILTER(
                'Table',
                'Table'[Response] >= 9 && 'Table'[Qestion]= "Q1_G1"
            )
        ),
        CALCULATE(
            COUNT('Table'[Response]),
            FILTER(
                'Table',
                'Table'[Response] >= 9 &&'Table'[Qestion] <> "Q1_G1"
            )
        )
    )
)

Here are the results:

vjianpengmsft_1-1739864990881.png

If you have any questions, please feel free to ask me.

 

 

Best Regards

Jianpeng Li

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

2 REPLIES 2
Anonymous
Not applicable

Hi, @SebaSpotti 

Based on your description, I used the following example data:

vjianpengmsft_0-1739864895729.png

Create the following measure:

num_good = 
SUMX(
    VALUES('Table'[Qestion]),
    IF(
        'Table'[Qestion] = "Q1_G1",
        CALCULATE(
            COUNT('Table'[Response]),
            FILTER(
                'Table',
                'Table'[Response] >= 9 && 'Table'[Qestion]= "Q1_G1"
            )
        ),
        CALCULATE(
            COUNT('Table'[Response]),
            FILTER(
                'Table',
                'Table'[Response] >= 9 &&'Table'[Qestion] <> "Q1_G1"
            )
        )
    )
)

Here are the results:

vjianpengmsft_1-1739864990881.png

If you have any questions, please feel free to ask me.

 

 

Best Regards

Jianpeng Li

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

 

 

ahmedoye
Responsive Resident
Responsive Resident

Try this patter:
IF(
       SELECTEDVALUE(Table[Column]) = "Q1_G1",
                   CALCULATE([num_good],
                                          Table[Column] = "Q1_G1",
                    CALCULATE([num_good],
                                          Table[Column] <> "Q1_G1")))

If this works for you, kindly mark as solution so it's easier for anyone with similar challenges to find the solution.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors