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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Hugz02
Frequent Visitor

Join Calendar table on 2 dates

Hello Everyone, 

I'm trying to do a Histogram chart for my company like this : 
On this one, the dates comes from my calendar table. 

2023-12-08_13h59_00.png


My data model looks like this : 

2023-12-08_14h00_07.png


But now, I cannot rely the 2 Incidents tables to each other on the incident ID. 
My idea, is very simple, I want to show on the chat, how many incident where created on a specific day and how many were close on the same day. It's working fine but if I want to filter by "Personne traitant l'incident" (for exemple), the closing incident don't move. 


I have tryed to rely my the two incidents tables on the Incident_id but my chart is not good anymore because all the dates will be the CreatedDate and not the Created and Closing Date

Do you have any idea how can I solve this ? 
(I can rebuilt my resquests on SQL if needed)



1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Hugz02 ,

 

For this you need to do two relationships with the calendar table:

Date - Open Date

Date - Closed Date

 

One of this relationships will be inactive so for that one you need to use a USERELATIONSHIP to activate it let's assume that the open date is the active relationship then for the closed you would need to do the following measure:

Closed incidents = CALCULATE(COUNT(Table[Incident]), USERELATIONSHIP(Calendar[Date], Table[CloseDate]))

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
Hugz02
Frequent Visitor

Hi @MFelix . Thx a lot for your answer, it works perfectly. 

MFelix
Super User
Super User

Hi @Hugz02 ,

 

For this you need to do two relationships with the calendar table:

Date - Open Date

Date - Closed Date

 

One of this relationships will be inactive so for that one you need to use a USERELATIONSHIP to activate it let's assume that the open date is the active relationship then for the closed you would need to do the following measure:

Closed incidents = CALCULATE(COUNT(Table[Incident]), USERELATIONSHIP(Calendar[Date], Table[CloseDate]))

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.