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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ALEX13
Helper I
Helper I

How to compare values in and out by dates

Hello,

 

I am trying to analyze the difference between HD (help desks) in and out for specific dates, here is an example of the data:

 

Asunto                                                     Start date          Final date       ID

No pueden contratar.30/01/2018 13:28:5230/01/2018 13:28:53MRG-HD-20180130-20871
No pueden contratar.30/01/2018 08:49:1430/01/2018 08:49:15MRG-HD-20180130-20862
ORDENES GENERADAS EN PUNTOS DE SUMINISTRO CESADOS 100071110529/11/2017 15:09:2430/11/2017 15:09:25MRG-HD-20171129-20357
NO SALTAN LAS CONTRATACIONES DE ALTA+TRANSFORMACION29/01/2018 16:03:1629/01/2018 16:03:17MRG-HD-20180129-20857

 

In the column Start date is the date when the ticket was created. In the column Final date is the date when the ticket was closed. 

I want to have a comparison between HDs in vs out by date, like: 

 

29/11/2017

HDs in: 3

HDs out: 1

Difference: 2

 

Any ideas on how to do it in Power BI?

Thank you very much!

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @ALEX13,

First, create a table including the unique start date and end date through New Table under Modeling, type the formula below.

Date =
UNION (
    SELECTCOLUMNS ( Table, "Date", Table[Start date] ),
    SELECTCOLUMNS ( Table, "Date", Table[Final date] )
)


Then, create a slicer using Date[Date], create three measure using the formulas.

HDs in =
CALCULATE (
    COUNT ( Table[Asunto] ),
    FILTER ( Table, Table[Start date] = SELECTEDVALUE ( Date[Date] ) )
)


HDs out =
CALCULATE (
    COUNT ( Table[Asunto] ),
    FILTER ( Table, Table[Final date] = SELECTEDVALUE ( Date[Date] ) )
)


Difference=ABS([HDs in]-[HDs out])


Best Regards,
Angelia

View solution in original post

4 REPLIES 4
v-huizhn-msft
Employee
Employee

Hi @ALEX13,

First, create a table including the unique start date and end date through New Table under Modeling, type the formula below.

Date =
UNION (
    SELECTCOLUMNS ( Table, "Date", Table[Start date] ),
    SELECTCOLUMNS ( Table, "Date", Table[Final date] )
)


Then, create a slicer using Date[Date], create three measure using the formulas.

HDs in =
CALCULATE (
    COUNT ( Table[Asunto] ),
    FILTER ( Table, Table[Start date] = SELECTEDVALUE ( Date[Date] ) )
)


HDs out =
CALCULATE (
    COUNT ( Table[Asunto] ),
    FILTER ( Table, Table[Final date] = SELECTEDVALUE ( Date[Date] ) )
)


Difference=ABS([HDs in]-[HDs out])


Best Regards,
Angelia

Hi Angelia, thank you very much for the solution.

One more question, what if i have blank cells in the final date column?

rocky09
Solution Sage
Solution Sage

@ALEX13

are you trying to get Hours? Days?

 

Also, can you please provide a clear example based on the data you have posted in your post.

Hi Rocky09,

I am trying to get the data based on days.

For the data of the example:

 

for the day 30/01 there are 2 HDs in and 2 HDs out, i.e., in the 30/01/2018 there were two HDs created, and two HDs closed.

 

Tell me if you need more details-

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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