Reply
SebaSpotti
Advocate II
Advocate II
Partially syndicated - Outbound

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
v-jianpeng-msft
Community Support
Community Support

Syndicated - Outbound

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
v-jianpeng-msft
Community Support
Community Support

Syndicated - Outbound

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

Syndicated - Outbound

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.

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)