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
ThomasBachmann
Frequent Visitor

Change salary cost from time intervals to minuts

I am trying to measure our salary cost by 15 min intervals.

Now we are only getting it by the day.

 

My current data looks like this:

NameStartEndMinutesSalary / MinuteTotal Salary
Amanda31-01-2019 10:0031-01-2019 20:00600                        1,67                          1.000    
Eduardo31-01-2019 12:0031-01-2019 22:47647                        1,67                          1.078    
Clara31-01-2019 12:3031-01-2019 20:15465                        2,00                             930    
Gabriel31-01-2019 16:0031-01-2019 22:46406                        1,67                             677    
Sofia31-01-2019 17:0031-01-2019 22:38338                        1,83                             620    
Jane31-01-2019 18:0031-01-2019 22:33333                        1,67                             555    
John31-01-2019 18:0031-01-2019 22:32272                        2,00                             544    

 

and the desired output looks like this:

TimeSalary
17:00                          132,50    
17:15                          132,50    
17:30                          132,50    
17:45                          132,50    
18:00                          187,50    
18:15                          187,50    
18:30                          187,50    
18:45                          187,50    

 

Can anybody help with accomplishing this?

7 REPLIES 7
v-shex-msft
Community Support
Community Support

HI @ThomasBachmann,

 

I'd like to suggest you create time interval table and bridge table with with name and time range, then use name field to link original table, time range to link time interval table.

 

 

Time interval Table =
SELECTCOLUMNS (
    GENERATESERIES ( TIME ( 0, 0, 0 ), TIME ( 23, 59, 59 ), TIME ( 0, 15, 0 ) ),
    "Time", [Value]
)

Bridge =
SELECTCOLUMNS (
FILTER (
CROSSJOIN ( Table, 'Time Interval' ),
[Time] >= TIMEVALUE ( [Start] )
&& [Time] <= TIMEVALUE ( [End] )
),
"Name", Table[Name],
"Time Range", [Time]
)

After these, you can simply create graph with time interval table and original table fields. 

 

Notice: It will generate huge amount of records with each time interval range defined by each row start end time.

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft

 

The solution does not work when we have a shift that stretches across two days.

Ex.

 

Start

15-02-2019 17:00:00 

 

End

16-02-2019 01:00:00

 

How to resolve this issue?

Hi @ThomasBachmann,

 

You can cross join date part with your records before expand time table, then add condition to check both date and time values.

 

BTW, I'm not so suggest you to expand date and time at same time.(it will generate huge amount of records)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft 

 

I have now created two crossjoined tables.

 

Workplan 1 =
FILTER (
CROSSJOIN ( Workplan; 'Date Table' );
'Date Table'[Dates] >= Workplan[Date.Start]
&& 'Date Table'[Dates] <= Workplan[Date.End]
)

 

--

 

Workplan 2 =
FILTER (
CROSSJOIN ( 'Workplan 1'; 'Time Table' );
'Time Table'[Time] >= TIMEVALUE('Workplan 1'[Start])
&& 'Time Table'[Time] <= TIMEVALUE('Workplan 1'[End])
)

 

However it is still not giving me shifts that cross two dates?

@v-shex-msft 

 

Is it possible to get further assistance in this case?

Hi @ThomasBachmann ,

 

If you expand both date and time part, bridge table will generate too many records.(it will effect performance)

 

In my opinion, I'd like to suggest you extract two table with date and time part, then you can build visuals through date/time dimensions.


Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you very much, it worked

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.

Top Solution Authors