Forum Discussion
BICrazy
7 years agoHelper II
Drop Seconds from Duration Measure
Hi, I'm very new to this forum and still a basic learner of Power BI. I'm using the following 2 measures to display Duration as Hours minutes and seconds. 1st Measure: Duration2Seconds = V...
- 7 years ago
BICrazy ok no worries, however the second script i posted does work.
vanessafvg
7 years agoCommunity Champion
you should just return your variables without the ts
VAR tH = IF(Hours=0,"",IF(Hours>1,Hours&" Hours, ",Hours&" Hour, "))
VAR tM = IF(Minutes=0,"",IF(Minutes>1,Minutes&" Minutes, ",Minutes&" Minute, "))
VAR tS = IF(Seconds=0,"",IF(Seconds>1,Seconds&" Seconds",Seconds&" Second"))
RETURN
CONCATENATE (th, CONCATENATE ("",CONCATENATE (tm,CONCATENATE )))
- BICrazy7 years agoHelper II
Hi Vanessafvg,
I tried not returning the seconds and the code doesn't work after that. I think the entire needs to accommodate dropping the seconds.
- vanessafvg7 years agoCommunity Champion
BICrazy what error are you getting? you can return what you want, setting the variable doesn't mean you have to return it
- vanessafvg7 years agoCommunity Champion
BICrazy does your code run with you original script?