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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Creating DAX rules to display received and sent dates based on one date column

Hello Folks, 

I really need your help to solve this problem that I have. I have the following sample data related to tickets treated during week number 15 of the month of April 2023, I would like to display the received and sent dates based on the Date of Action column (and only display the dates related to week number 15 of April, I have created a relationship btw between the date table and Date of Action column, but some outputs are still not correct), then calculate the time difference between the two (if the result is zero then it is understood that the ticket treatment was achieved in less than a day). 

I have implemented the following DAX calculations (thanks to user @P_d2023 ) to get the results I have shown in the Power canvas belo

PERSON_TIMELINE = RANKX(FILTER(WEEKLY_IDs, WEEKLY_IDs[Ticket_Nb] = EARLIER(WEEKLY_IDs[Ticket_Nb]) && WEEKLY_IDs[Sender_Name] = EARLIER(WEEKLY_IDs[Sender_Name])), WEEKLY_IDs[Date_of_Action], , ASC, Dense)

 

TICKET_TIMELINE = RANKX(FILTER(WEEKLY_IDs, WEEKLY_IDs[Ticket_Nb] = EARLIER(WEEKLY_IDs[Ticket_Nb])),WEEKLY_IDs[Date_of_Action], , ASC, Dense)

From the above calculations, I created the three columns shown in the Power BI report below:

RECEIVED_DATE = CALCULATE(MIN(WEEKLY_IDs[Date_of_Action]), ALLEXCEPT(WEEKLY_IDs, WEEKLY_IDs[Ticket_Nb]), WEEKLY_IDs[TICKET_TIMELINE]=WEEKLY_IDs[PERSON_TIMELINE]) 

REPLY_DATE =

IF(

    ISBLANK(CALCULATE(MIN(WEEKLY_IDs[Date_of_Action]), ALLEXCEPT(WEEKLY_IDs, WEEKLY_IDs[Ticket_Nb]), WEEKLY_IDs[TICKET_TIMELINE] > WEEKLY_IDs[PERSON_TIMELINE])),

    WEEKLY_IDs[RECEIVED_DATE],

    CALCULATE(MIN(WEEKLY_IDs[Date_of_Action]), ALLEXCEPT(WEEKLY_IDs, WEEKLY_IDs[Ticket_Nb]), WEEKLY_IDs[TICKET_TIMELINE] > WEEKLY_IDs[PERSON_TIMELINE])

)

 
Treatment Duration = if(INT([REPLY_DATE])-INT([RECEIVED_DATE]) <= 0,0,

    INT([REPLY_DATE]) - INT([RECEIVED_DATE]))



 

Jack_Reacher_0-1681901726783.png

Jack_Reacher_1-1681902770023.png

 

 

1 REPLY 1
P_d2023
Regular Visitor

hi jack,

this is because you are filtering to the person which is in effect is filtering the lines and stopping the calculation working. this calculation will only work if the ticket nb is summed. this would still work if you filtered to a certain week.

 

this is difficult as you dont have a column which states request or response so this can only be calcuated at ticket level.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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