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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Counting same event with two dates using same Dim Date and USERELATIONSHIP

Hello,

 

I need to retrive the number of Due events for month/year, retrieve also the number of events done on the same month/year. 

In my dataset I have two tables

1) Maintenance_Jobs_Archive

2) Dim_Date

 

Maintenance_Jobs_Archive have two relationships with Dim_date:

1) Active [Due Date]

2) Inactive [Done Date]

 

 

dataDim.png

 

I'm Creating two measures using "Userelationship"

1)# Done Jobs (Archive) = CALCULATE(COUNT(VW_MAINTENANCE_JOBS_ARCHIVE[Job ID]), USERELATIONSHIP(VW_MAINTENANCE_JOBS_ARCHIVE[Done Date], 'T_BASS_DIM_DATE (Jobs)'[Date]),FILTER(VW_MAINTENANCE_JOBS_ARCHIVE,VW_MAINTENANCE_JOBS_ARCHIVE[Maintenance Type]="Scheduled Maintenance"))

 

2)
# Due Jobs (Archive) = CALCULATE(COUNT(VW_MAINTENANCE_JOBS_ARCHIVE[Job ID]), USERELATIONSHIP(VW_MAINTENANCE_JOBS_ARCHIVE[Due Date], 'T_BASS_DIM_DATE (Jobs)'[Date]),FILTER(VW_MAINTENANCE_JOBS_ARCHIVE,VW_MAINTENANCE_JOBS_ARCHIVE[Maintenance Type]="Scheduled Maintenance"))

 

When I had the two measures in to a Matrix visualization, the result is not the expected for the Inactive Relationship. In the Done Date measure just return the count were the Jobs were Due and Done on the same date.

 

dataDim2.png

the due jobs count it's correct show the done jobs are just counting the number of due date is the same as done date

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Just to let you know that did find the issue.

 

The solution is not using the "Filter" function from the measure. 

 

# Done Jobs (Archive) = CALCULATE(COUNT(VW_MAINTENANCE_JOBS_ARCHIVE[Job ID]), USERELATIONSHIP(VW_MAINTENANCE_JOBS_ARCHIVE[Done Date], 'T_BASS_DIM_DATE (Jobs)'[Date]))

 

# Due Jobs (Archive) = CALCULATE(COUNT(VW_MAINTENANCE_JOBS_ARCHIVE[Job ID]), USERELATIONSHIP(VW_MAINTENANCE_JOBS_ARCHIVE[Due Date], 'T_BASS_DIM_DATE (Jobs)'[Date]))

 

So if  you use USERELATIONSHIP, dont user "Filter"

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Just to let you know that did find the issue.

 

The solution is not using the "Filter" function from the measure. 

 

# Done Jobs (Archive) = CALCULATE(COUNT(VW_MAINTENANCE_JOBS_ARCHIVE[Job ID]), USERELATIONSHIP(VW_MAINTENANCE_JOBS_ARCHIVE[Done Date], 'T_BASS_DIM_DATE (Jobs)'[Date]))

 

# Due Jobs (Archive) = CALCULATE(COUNT(VW_MAINTENANCE_JOBS_ARCHIVE[Job ID]), USERELATIONSHIP(VW_MAINTENANCE_JOBS_ARCHIVE[Due Date], 'T_BASS_DIM_DATE (Jobs)'[Date]))

 

So if  you use USERELATIONSHIP, dont user "Filter"

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.