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
Anonymous
Not applicable

Converting Tableau Calculation to Power BI

Hi

I have this column in a tableau dashboard that I built and I was wondering how I convert the data in the same way. I am trying it through the custom column in Power Bi. My calculation in Tableau was

STR(INT(SUM([Total Display Time])/86400))

+ " Days, " +

IF (INT(SUM([Total Display Time])%86400/3600))

< 10 THEN "0" ELSE "" END + STR(INT(SUM([Total Display Time])%86400/3600))

+ " Hours, " +

IF INT(SUM([Total Display Time])%3600/60)

< 10 THEN "0" ELSE "" END + STR(INT(SUM([Total Display Time])%3600/60))

+ " Minutes, " +

IF INT(SUM([Total Display Time]) %3600 %60)

< 10 THEN "0" ELSE "" END + STR(INT(SUM([Total Display Time]) %3600 %60))

+ " Seconds "

 

Could someone possibly help me convert this to a Power BI to end with the same results?

 

TIA

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@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.

View solution in original post

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@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.
amitchandak
Super User
Super User

@Anonymous , In power query

 

Duration(Number.IntegerDivide(Number.FromText([Cycle:duration]),86400) ,Number.IntegerDivide(Number.Mod(Number.FromText([Cycle:duration]),86400),3600),
Number.IntegerDivide(Number.Mod(Number.Mod(Number.FromText([Cycle:duration]),86400),3600),60),
Number.Mod(Number.Mod(Number.Mod(Number.FromText([Cycle:duration]),86400),3600),60)
)

 

DAX  - Measure or column both will work
Quotient([Total Display Time],86400) & ":" Quotient(mod([Total Display Time],86400),3600) &":" & Quotient(mod(mod([Total Display Time],86400),3600),60) &":" & mod(mod(mod([Total Display Time],86400),3600),60)

Anonymous
Not applicable

Unfortunately this didn't work in my custom column am I doing something wrong?

 

Thanks

 

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.