Forum Discussion

rudyCoastal's avatar
rudyCoastal
New Member
3 years ago
Solved

Trying to create a measure for counting dates from two different fields.

Good afternoon all,

 

I have a table that looks a lot like the example below. Also, I have a date dimension table that has an active relationship to the Opened field and an inactive relationship to the Closed field.

 

From the data below, I would like to create a bar chart that has the months along the X access, and a count of tickets along the Y. For example, based on the data below, we would like two bars coming up from Jan 2023. One bar for Opened (equals 2) and the another for Closed (=2). Then for Feb 2023, again two bars: Opened (=3) and Closed (=1). Finally for Mar 2023, two bars: Opened (=2) and Closed (=3).

 

I'm figuring I have to do this with DAX Measures, but I've hit a wall and any help would be appreciated!

 

OpenedClosedTechTicket Desc
1/2/20231/5/2023DonBroken mouse
1/4/20231/15/2023JohnBroken monitor
2/20/20232/21/2023JohnNeed update
2/25/20233/4/2023DonDo I need to reboot?
2/25/20233/5/2023DonScreen flicker
3/1/20233/2/2023JohnNeed PC
3/6/2023 JohnHow do I?

 

Thank you in advanced!

  • DOLEARY85's avatar
    DOLEARY85
    3 years ago

    Ah okay you want it to also filter out based on the active relationship, you just need to add the other relationship as a filter too, try:

     

    mClosed2 = CALCULATE(COUNT('HELP DESK Ticket'[Close Date]), USERELATIONSHIP('HELP DESK Ticket'[Close Date],'Date'[Date]),USERELATIONSHIP('HELP DESK Ticket'[Open Date],'Date'[Date]))


    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍