The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Como incluir uma coluna personalizada que multiplique uma coluna com valor inteiro por uma coluna de hora? O Excel converte a hora em número serial e multiplica normalmente, mas no power query não estou conseguindo.
Solved! Go to Solution.
Proud to be a Super User! | |
To multiply an integer column by a time column in Power Query, first ensure the time column is in the "time" data type. Then, create a custom column using the formula
= [IntegerColumn] * (Duration.From([TimeColumn]) / #duration(1, 0, 0, 0))
This converts the time column to a duration (fraction of a day) and multiplies it by the integer column. The result will be the integer value multiplied by the equivalent hours from the time column.
It works in Excel because Excel stores times as numbers.
But what is your point of this multiplication in Power Query?
I ask because Power Query does has both a Time data type as well as a Duration data type. In Excel, both are stored as numbers and can be displayed in a variety of methods.
In Power Query, a "time" data type cannot be equal to or greater than 24 hours.
A "duration" data type can be, and can be multiplied by an integer with the result being a duration.
If you are really multiplying a Duration by an integer, then ensure your "time" is a Duration type, and merely multiply it.
Proud to be a Super User! | |