Forum Discussion
Converting Tableau Calculation to Power BI
- Anonymous4 years ago
Anonymous
Try create this using dax with calculate column:
CONCATENATE(SUM([Total Display Time])/86400,
CONCATENATE("Days"
CONCATENATE(IF(SUM([Total Display Time])/86400/3600<10,"0",""),
CONCATENATE("Hours",
CONCATENATE(IF(SUM([Total Display Time])/3600/60<10,"0",""),
CONCATENATE("Minutes",
CONCATENATE(IF(SUM([Total Display Time])/3600/60<10,"0",""),
CONCATENATE(SUM([Total Display Time]) /3600/60), "Seconds"))))))))Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
Before jumping into the solution, it would help to clarify how you’re planning to analyze or visualize this data. For example, the LOD (Level of Detail) logic you used in Tableau—was it applied as a calculated field or aggregated measure? Similarly, in Power BI, whether you need a measure or a calculated column will influence how the solution is implemented.
Here’s the DAX equivalent that mimics your Tableau formatting:
Formatted Display Time :=
VAR TotalSeconds = SUM('YourTable'[Total Display Time])
VAR Days = INT(TotalSeconds / 86400)
VAR Hours = INT(MOD(TotalSeconds, 86400) / 3600)
VAR Minutes = INT(MOD(TotalSeconds, 3600) / 60)
VAR Seconds = MOD(TotalSeconds, 60)
VAR FormattedHours = IF(Hours < 10, "0" & Hours, FORMAT(Hours, "0"))
VAR FormattedMinutes = IF(Minutes < 10, "0" & Minutes, FORMAT(Minutes, "0"))
VAR FormattedSeconds = IF(Seconds < 10, "0" & Seconds, FORMAT(Seconds, "0"))
RETURN
FORMAT(Days, "0") & " Days, " &
FormattedHours & " Hours, " &
FormattedMinutes & " Minutes, " &
FormattedSeconds & " Seconds"
Did I answer your question? Mark my post as a solution!
Also, if you're frequently working with DAX, I'd highly recommend using a tool like DAX Optimizer Gen AI.