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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

to sum distinct values

Hi all, 

could you please help me with the following question?

I have a table: 

 

image.png

 

and I calculate distinct projectID: 

image.png

I know how it works, but users ask for summarizing values in total.

in other words it is supposed to have 5 (1+2+2) instead of 3 in total. 

Could you please come up with any idea how I can calculate it? 

 

I shared my PowerBI test data  . 

Thank you for your support!

 

BR, 

Valeria

 
1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please try this formula. Or refer to the .pbix file.

Measure 2 = 
VAR x = 
CALCULATE(
    COUNT(prdoctypes[projectID]),
    FILTER(
        prdoctypes,
        prdoctypes[doctype] = MAX( prdoctypes[doctype])
    )
)
RETURN
IF(
    HASONEFILTER(prdoctypes[projectID]),
    x,
    COUNT(prdoctypes[projectID])
)

vvv8.PNG

 

Best regards,
Lionel Chen

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

Hi @Anonymous ,

 

Please create a measure like this.

Measure 2 = 
CALCULATE(
    COUNT(prdoctypes[projectID]),
    ALLEXCEPT( prdoctypes, prdoctypes[doctype])
)

fff7.PNG 

 

Best regards,
Lionel Chen

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-lionel-msft  

Thank you fo your support!

 

It works, but resource filter is supposed to work.

I added new values for testing and when I use your calculations, a filter is frozen

image.png

Can you see above differences in 'measure 2'? It appears the same at any time.

Could you please provide any options how to keep other filters? 

 

BR, 

Valeria

Hi @Anonymous ,

 

Please try this formula. Or refer to the .pbix file.

Measure 2 = 
VAR x = 
CALCULATE(
    COUNT(prdoctypes[projectID]),
    FILTER(
        prdoctypes,
        prdoctypes[doctype] = MAX( prdoctypes[doctype])
    )
)
RETURN
IF(
    HASONEFILTER(prdoctypes[projectID]),
    x,
    COUNT(prdoctypes[projectID])
)

vvv8.PNG

 

Best regards,
Lionel Chen

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors