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
Divous
Helper III
Helper III

Distinct SUM

Hi community,

 

I have table user_subscription with columns:
user_id - uuid

connector_id (groups) - with two values (bank and manual)

created_at - date in YYYY-MM-DD HH:MM:SS

help_column - created by me with value 1 in every row for easy calculation

 

My goal is to show cumulative stacked column chart.
I am almost done. My formula is:

 

Connections = CALCULATE(SUM('public user_subscription'[Help_column]),FILTER(ALLEXCEPT('public user_subscription','public user_subscription'[connector_id (groups)]),'public user_subscription'[created_at] <= MAX('public user_subscription'[created_at])))

 

 

and it show nice chart:

Divous_0-1627471974133.png

 

Problem what I have is that I dont know how to distinct users by their user_id (unique for user), because many users can have more than one BANK or BANK and MANUAL connections together.

I need show values only per user. How to polish my formula? Or its completly wrong?

Thanks in advance!

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Divous ,

 

Try the following formula:

 

Connections = 
CALCULATE(
    SUM('public user_subscription'[Help_column]),
    FILTER(
        ALL('public user_subscription'[created_at]),
        'public user_subscription'[created_at] <= MAX('public user_subscription'[created_at])
    )
)

vkkfmsft_0-1627620336532.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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-kkf-msft
Community Support
Community Support

Hi @Divous ,

 

Try the following formula:

 

Connections = 
CALCULATE(
    SUM('public user_subscription'[Help_column]),
    FILTER(
        ALL('public user_subscription'[created_at]),
        'public user_subscription'[created_at] <= MAX('public user_subscription'[created_at])
    )
)

vkkfmsft_0-1627620336532.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

amitchandak
Super User
Super User

@Divous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Try like

 

Connections = CALCULATE(SUMX(values('public user_subscription'[User_id]),calculate(Max('public user_subscription'[Help_column]))),FILTER(ALLEXCEPT('public user_subscription','public user_subscription'[connector_id (groups)]),'public user_subscription'[created_at] <= MAX('public user_subscription'[created_at])))

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.