Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I Have raw data duration , where the format is not standard like this
i want to convert from Column "Down" to column "inSEC" using this query to manage the d=86400 seconds, h=3600seconds , m =60 seconds
and i want to the query automaticly calculate the "multiply" and "add"
example in 31d = 31*86400 = 2,678,400 seconds
Solved! Go to Solution.
inSec =
SUMX (
ADDCOLUMNS (
DATATABLE (
"n", STRING,
"f", INTEGER,
{
{ "d", 86400 },
{ "h", 3600 },
{ "m", 60 },
{ "s", 1 }
}
),
"@sec",
VAR _p =
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
MID ( 'Report'[Down], 1, FIND ( [n], 'Report'[Down],, 1 ) - 1 ),
"m",
"|"
),
"h",
"|"
),
"d",
"|"
)
RETURN
VALUE ( 0 & PATHITEM ( _p, PATHLENGTH ( _p ) ) ) * [f]
),
[@sec]
)
inSec =
SUMX (
ADDCOLUMNS (
DATATABLE (
"n", STRING,
"f", INTEGER,
{
{ "d", 86400 },
{ "h", 3600 },
{ "m", 60 },
{ "s", 1 }
}
),
"@sec",
VAR _p =
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
MID ( 'Report'[Down], 1, FIND ( [n], 'Report'[Down],, 1 ) - 1 ),
"m",
"|"
),
"h",
"|"
),
"d",
"|"
)
RETURN
VALUE ( 0 & PATHITEM ( _p, PATHLENGTH ( _p ) ) ) * [f]
),
[@sec]
)
I Got it, why error, because thereis space between data, i add subtitute to remove space
Column =
SUMX (
ADDCOLUMNS (
DATATABLE (
"n", STRING,
"f", INTEGER,
{
{ "d", 86400 },
{ "h", 3600 },
{ "m", 60 },
{ "s", 1 }
}
),
"@sec",
VAR _p =
SUBSTITUTE( SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
MID ( 'Report'[Down], 1, FIND ( [n], 'Report'[Down],, 1 ) - 1 ),
"m",
"|"
),
"h",
"|"
),
"d",
"|"
)," ","")
RETURN
VALUE ( 0 & PATHITEM ( _p, PATHLENGTH ( _p ) ) ) * [f]
),
[@sec]
)
I Got error- " cannot convert value 0 45 of type Text to type number"
add one more subtitute to remove space from data.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 10 | |
| 9 | |
| 7 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 15 | |
| 13 | |
| 11 | |
| 9 |