Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I would like to convert hours to minutes.
How can I make this with qlik Sense (Back-end script) ?
Can someone help with this issue please ?
Thank you in advance
You can modify above script
LOAD
Ticket,
Working_Hour,
Floor(Working_Hour * 60) AS [Minutes], // Extract Whole Minutes
Round((Working_Hour * 60 - Floor(Working_Hour * 60)) * 60) AS [Seconds], // Extract Remaining Seconds
Floor(Working_Hour * 60) & ' minutes and ' & Round((Working_Hour * 60 - Floor(Working_Hour * 60)) * 60) & ' seconds' AS [Formatted Time]
INLINE [
Ticket, Working_Hour
1, 160.56
2, 20.3
3, 53.32
4, 10.5
5, 25.1
];
You can calculate minutes by simply multiplying your hour field by 60 in the script. For example:
Working_Hour * 60 AS [Expected minutes]
Here’s a sample script showing how it works:
LOAD
Ticket,
Working_Hour,
Working_Hour * 60 AS [Expected minutes]
INLINE [
Ticket, Working_Hour
1, 160.56
2, 20.3
3, 53.32
4, 10.5
5, 25.1
];
This will give you the minutes based on your hour values.
Thank you for the feedback.
What can I do if iwant to view as : 9633 minutes and ..... secondes
Do you have any suggestion ?
You can modify above script
LOAD
Ticket,
Working_Hour,
Floor(Working_Hour * 60) AS [Minutes], // Extract Whole Minutes
Round((Working_Hour * 60 - Floor(Working_Hour * 60)) * 60) AS [Seconds], // Extract Remaining Seconds
Floor(Working_Hour * 60) & ' minutes and ' & Round((Working_Hour * 60 - Floor(Working_Hour * 60)) * 60) & ' seconds' AS [Formatted Time]
INLINE [
Ticket, Working_Hour
1, 160.56
2, 20.3
3, 53.32
4, 10.5
5, 25.1
];
although this question already has a solution I just wanted to propose this one as well:
table1:
LOAD Ticket,
WorkingHour,
Dual(Replace(Interval(WorkingHour/24,'mm:ss'),':',' minutes and ')&' seconds',WorkingHour/24) as ExpectedMinutes
Inline [
Ticket, WorkingHour
1,160.56
2,20.3
3,53.32
4,10.5
5,25.1
];
Thank you for the propose.
This is an easy way to deal with that case as well
glad you liked it