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

Cumulative Totals per user in a table by selected period

Hi Power BI Community ! 

I am a new Power BI and need your help in solving my solution.

 

In the below image, I have created a table visual which has user_id , Total Bookings and Cumulative Bookings by User.

I need to have each user's cumulative booking count from their earliest booking date to the period filtered by the slicer.

Unfortunately, my Cumulative Bookings by User is only getting the the cumulative booking of that month itself. (In this instance, when I have selected 2021 April) 

 

We can see that for the first user_id, user has 45 Cumulative Bookings in April 2021, but in actual fact, user's Cumulative Bookings is 57.

 

halu486_1-1648186205194.png

 

An example of what I wish to achieve:

(I achieved this by performing multiple selection on the Month data, which is not an ideal way to perform cumulative totals manually) This example shows the correct Cumulative Bookings by the first user_id.

halu486_2-1648186309397.png

 

Here is the code for my Cumulative Bookings by User:

Cumulative Bookings by User =
CALCULATE( COUNT('Bookings'[booking_no]),
FILTER( ALL( 'Bookings'[Booking Date] ),
'Bookings'[Booking Date] <= MAX('Bookings'[Booking Date]))
)

 

Appreciate any advice and solutions !

Thank you.

 

 

 

 

 

 

 

 

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

Hi @Anonymous ,

 

Because you are using a date table to filter the Bookings table

 

vkkfmsft_0-1648538041576.png

 

you will need to change the formula to

 

Measure = 
CALCULATE (
    COUNT ( 'Bookings'[booking_no] ),
    FILTER ( ALL ( Dates ), Dates[Date] <= MAX ( Dates[Date] ) )
)

vkkfmsft_1-1648538111561.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 @Anonymous ,

 

Because you are using a date table to filter the Bookings table

 

vkkfmsft_0-1648538041576.png

 

you will need to change the formula to

 

Measure = 
CALCULATE (
    COUNT ( 'Bookings'[booking_no] ),
    FILTER ( ALL ( Dates ), Dates[Date] <= MAX ( Dates[Date] ) )
)

vkkfmsft_1-1648538111561.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

@Anonymous , try like

 

Cumulative Bookings by User =
CALCULATE( COUNT('Bookings'[booking_no]),
FILTER( ALL( 'Bookings'[Booking Date] ),
'Bookings'[Booking Date] <= MAX('Bookings'[Booking Date])
&& 'Bookings'[User_id] = MAX('Bookings'[User_id])
)
)

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.