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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

measure total with multiple criteria

Hi all,

I have this measure ( SkillCount = var reportskill = SELECTEDVALUE(Sheet1[Skills])  return

COUNTROWS(

    Filter(ADDCOLUMNS(SUMMARIZE(Sheet1,Sheet[User ID],Sheet1[Skills],Sheet1[Sub-skills]),"Sum", CALCULATE(SUMX(Sheet1,'Sheet1'[% trainings]),FILTER(Sheet1,'Sheet1'[User ID] = EARLIER(Sheet1[User ID]) && 'Sheet1'[Skills] = EARLIER(Sheet1[Skills]) && 'Sheet1'[Sub-skills] = EARLIER(Sheet1[Sub-skills])

    ))),'Sheet1'[Skills] = reportskill  &&  [Sum]>=0.99)) )

for this data that gives me the number of User IDs for each skill, but Power BI does not give me the total of IDs, but I want distinctcount of the IDs because sometimes there is the same User ID that do two or more skills and for the total I only want to count the corresponding User ID once.

Capture.PNG

Can you help me please?

Thank you 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

We can use the following measure to meet your requirement. If ID has two skills, we count it once, the total should be 8.

 

 

Measure = COUNTROWS(FILTER(DISTINCT('Sheet1'[User ID]),CALCULATE(SUM(Sheet1[% trainings])>=0.99)))

 

 

31.png

 

In your screenshot, the 1234 counts twice. Maybe you didn’t notice this, and marked it in two colors.

 

32.png

 

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong 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

7 REPLIES 7
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can use the SUMX function in following measure to meet your requirement. Add the SUMX function outside the measure and delete the SELECTEDVALUE function.

 

SkillCount =

SUMX (

    VALUES ( 'Sheet1'[Skills] ),

    VAR reportskill = Sheet1[Skills]

    RETURN

        COUNTROWS (

            FILTER (

                ADDCOLUMNS (

                    SUMMARIZE ( Sheet1, Sheet1[User ID], Sheet1[Skills], Sheet1[Sub-skills] ),

                    "Sum", CALCULATE (

                        SUMX ( Sheet1, 'Sheet1'[% trainings] ),

                        FILTER (

                            Sheet1,

                            'Sheet1'[User ID] = EARLIER ( Sheet1[User ID] )

                                && 'Sheet1'[Skills] = EARLIER ( Sheet1[Skills] )

                                && 'Sheet1'[Sub-skills] = EARLIER ( Sheet1[Sub-skills] )

                        )

                   )

                ),

                'Sheet1'[Skills] = reportskill

                    && [Sum] >= 0.99

            )

        )

)

 

We can get the result like this,

 

 

31.png

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

This is the sum of the User IDs that have skills but I want distinctcount of the User IDs.

For example, I have the first table but I want the second table.Capture.PNG

Can you help me please?

Thank you

Hi @Anonymous ,

 

We can use the measure to meet your requirement.

 

 

SkillCount =
SUMX (
    VALUES ( 'Sheet1'[Skills] ),
    VAR reportskill =
        MAX ( Sheet1[Skills] )
    RETURN
        COUNTROWS (
            FILTER (
                ADDCOLUMNS (
                    SUMMARIZE ( Sheet1, Sheet1[User ID], Sheet1[Skills], Sheet1[Sub-skills] ),
                    "Sum", CALCULATE (
                        SUMX ( Sheet1, 'Sheet1'[% trainings] ),
                        FILTER (
                            Sheet1,
                            'Sheet1'[User ID] = EARLIER ( Sheet1[User ID] )
                                && 'Sheet1'[Skills] = EARLIER ( Sheet1[Skills] )
                                && 'Sheet1'[Sub-skills] = EARLIER ( Sheet1[Sub-skills] )
                        )
                    )
                ),
                'Sheet1'[Skills] = reportskill
                    && [Sum] >= 0.99
            )
        )
)

 

 

It is the same measure as before except we add MAX function in the fourth row.

 

Then we can get the result like this,

 

31.png

 

BTW, pbix as attached.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

 

I'm sorry but I don't want the MAX. I have an initial table with all the IDs, skills, trainings and % trainings, and I want the ID's DISTINCTCOUNT by applying the built formula, not the maximum.
Can you help me? If you need to be more explicit say it. Basically I want the ID DISTINCTCOUNT but applying the initial formula that I did and show you.

 

Thank you

Hi @Anonymous ,


Sorry for that we attached incorrect screenshot, please see following result screenshot which use measure of our previous reply, If it does not meet your requirement, could you please show more complex sample mockup data with expected result?

 

31.png


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-lid-msft ,

I added colors to file and more data to make the exercise more noticeable. Therefore, in this data, all IDs that have color have at least 1 skill. The ID 7410 has two skills but I only want to count it once, that is, I want to remove duplicates in total.

So, in these data we realize that the IDs that have at least one skill are the ones that are in color (which totals 9 IDs).
Can you help me find a formula in Power BI to get to the second table?

skills.PNG

Thank you very much 

 

Hi @Anonymous ,

 

We can use the following measure to meet your requirement. If ID has two skills, we count it once, the total should be 8.

 

 

Measure = COUNTROWS(FILTER(DISTINCT('Sheet1'[User ID]),CALCULATE(SUM(Sheet1[% trainings])>=0.99)))

 

 

31.png

 

In your screenshot, the 1234 counts twice. Maybe you didn’t notice this, and marked it in two colors.

 

32.png

 

 

BTW, pbix as attached.

 

Best regards,

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors