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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.