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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Sum of Distinct Values

Hello, I am trying to calculate sum of keys for the following table of data

 

ApplicationData SubjectTable Number of Keys
App1AccountA1000
App1CustomerB500
App1AssetsC8000
App1AccountD1000
App1AccountE1000
App2AccountF200
App2CustomerG50
App2AssetsH150
App2AccountI200
App2AccountJ200
App2CustomerK50

 

Filter: None 

Expected Total = (1000+500+8000+200+50+150)=9900

 

Filter: App1 

Expected Total = (1000+500+8000) = 9500

 

Filter: App2, Account

Expected Total = 200

 

Filter: Account

Expected Total = (1000+200) = 1200

 

I have a feeling it can be done with SUMX but not sure how to do it.

 

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Try this measure:

 

KeyCount =
CALCULATE (
    SUMX (
        SUMMARIZE (
            Keys,
            Keys[Application],
            Keys[Data Subject],
            "NumKeys", MAX ( Keys[Number of Keys] )
        ),
        [NumKeys]
    )
)

Hope this helps

David

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

=SUMX(VALUES(Data[Number of Keys]),[Number of Keys])

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

this is what I was expecting.

 

thank you so much.

 

Regards.,

Swamy

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Vvelarde
Community Champion
Community Champion

@Anonymous

 

 

Hi, try with this:

 

Sum_DistinctValues =
SUMX (
    SUMMARIZE (
        Table1;
        Table1[Application],
        Table1[DataSubject],
        Table1[Number of Keys]
    ),
    [Number of Keys]
)

Regards

 

Victor




Lima - Peru
dedelman_clng
Community Champion
Community Champion

Try this measure:

 

KeyCount =
CALCULATE (
    SUMX (
        SUMMARIZE (
            Keys,
            Keys[Application],
            Keys[Data Subject],
            "NumKeys", MAX ( Keys[Number of Keys] )
        ),
        [NumKeys]
    )
)

Hope this helps

David

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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