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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
syl-ade
Helper I
Helper I

How to show sum when no filter is applied - USERELATIONSHIP function

Hi all, 

 

I am currently working on HR Analysis Dashboard. I have created measures like Starters and Leavers.

Leaver look like this 

 

Leavers = 
CALCULATE( 
[Count of Employees]
, USERELATIONSHIP(
    'Calendar'[Date]
    , hra_datasource[end_date] 
    )
)

 

 

There is a relationship with the calendar so the correct measure is only shown when date filter is applied. So when date filter is not applied it looks like that:

sylade_0-1714465629329.png

I would like to see as default the total for leavers and starters of the company. Is there a way to do that in PowerBI?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @syl-ade ,

You can update the formula of measure [Leavers] as below and check if it can return the expected result...

Leavers =
IF (
    ISFILTERED ( 'Calendar'[Date] ),
    CALCULATE (
        [Count of Employees],
        USERELATIONSHIP ( 'Calendar'[Date], hra_datasource[end_date] )
    ),
    CALCULATE ( [Count of Employees], ALL ( hra_datasource ) )
)

If the above ones can't help you figure out, please provide some raw data in your table 'hra_datasource' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @syl-ade ,

You can update the formula of measure [Leavers] as below and check if it can return the expected result...

Leavers =
IF (
    ISFILTERED ( 'Calendar'[Date] ),
    CALCULATE (
        [Count of Employees],
        USERELATIONSHIP ( 'Calendar'[Date], hra_datasource[end_date] )
    ),
    CALCULATE ( [Count of Employees], ALL ( hra_datasource ) )
)

If the above ones can't help you figure out, please provide some raw data in your table 'hra_datasource' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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.