cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Divous
Helper II
Helper II

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.

View solution in original post

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])))

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors