Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
usmanrafiq
Helper I
Helper I

Concatenate Measure and String

Hello, 

I want to create a measure that calculates avg session duration and attach "min" or "sec" word with it based on following condition

 
Avg. Session Duration = if(AVERAGE(driviology2[ga:avgSessionDuration])/60 >= 1 , AVERAGE(driviology2[ga:avgSessionDuration])/60 ,SUM(driviology2[ga:avgSessionDuration]))
 
If i create another measure for sec or min and concatenate with above calculation , its gave me error. 
 
I want to use it in cards visual. 
 
Expected output would be 
1.5 mins or  
35 secs  
 
 
1 ACCEPTED SOLUTION
rajatanand
Regular Visitor

Avg. Session Duration = if(AVERAGE(driviology2[ga:avgSessionDuration])/60 >= 1 , AVERAGE(driviology2[ga:avgSessionDuration])/60 & " mins" ,SUM(driviology2[ga:avgSessionDuration]) & " secs")

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

AllisonKennedy
Community Champion
Community Champion

@usmanrafiq you don't need to create another measure for mins or secs, just add this to the existing measure:

Avg. Session Duration = if(AVERAGE(driviology2[ga:avgSessionDuration])/60 >= 1 , AVERAGE(driviology2[ga:avgSessionDuration])/60 ,SUM(driviology2[ga:avgSessionDuration])) & " mins"

You can also do some limited custom formatting in the measures using the Model Properties view; https://radacad.com/custom-format-fields-and-measures-in-power-bi


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

rajatanand
Regular Visitor

Avg. Session Duration = if(AVERAGE(driviology2[ga:avgSessionDuration])/60 >= 1 , AVERAGE(driviology2[ga:avgSessionDuration])/60 & " mins" ,SUM(driviology2[ga:avgSessionDuration]) & " secs")

Fowmy
Super User
Super User

@usmanrafiq 

I am not sure what your column driviology2[ga:avgSessionDuration] returns, is t seconds or Minutes ?

Wrap with FORMAT ([Measure],"General") & "Min"

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.