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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Cumulative distinct count with related table

Hi team,

 

I'm calculating distinct count of users logged in for last 7 days and cumulative of it.

 
Cumulative Unique User =
CALCULATE (
DISTINCTCOUNT('Login Info'[User Name]),
FILTER (
ALLSELECTED('Login Info'),
'Login Info'[End Date]
<= MAX ('Login Info'[End Date] )
)

 

My problem arises when i add Region in to the chart. Its showing the same cumulative for all regions.  Regions are from related table called 'Locations' which is combined based on the "username" column.

 

Kindly help me how can i alter my formula to get the region cumulative.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I could achieve it by amending my formula as below :

 

Cumulative Unique User =
CALCULATE (
DISTINCTCOUNT('Login Info'[User Name]),
FILTER (
ALL('Login Info'),
'Login Info'[End Date]
<= MAX ('Login Info'[End Date] )),FILTER(RELATEDTABLE(UserLocation),UserLocation[Region]=UserLocation[Region])
)

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous 

The formula seems right. But better you create a date table and join with End date an then use this formula

Cumulative Unique User =
CALCULATE (
DISTINCTCOUNT('Login Info'[User Name]),
FILTER (
ALLSELECTED('Date'),
'Date'[Date]
<= MAX ('Date'[Date] )
)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Yes. the formula is correct. However, i cant get it to work in my visual.

 

I'm using the custom visual "Small Multiple Line". when i add Regions into view, this visual creates multiple line charts with unique users count in line and date in x axis.  However the cumulative is not fixed per region. it has to calculate region wise cumulative. 

 

Any other idea?

Anonymous
Not applicable

I could achieve it by amending my formula as below :

 

Cumulative Unique User =
CALCULATE (
DISTINCTCOUNT('Login Info'[User Name]),
FILTER (
ALL('Login Info'),
'Login Info'[End Date]
<= MAX ('Login Info'[End Date] )),FILTER(RELATEDTABLE(UserLocation),UserLocation[Region]=UserLocation[Region])
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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