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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mjanecek
Helper I
Helper I

Need Help With Calculated Column

I have a dimension table called Markets that has 2 columns, Market Name(Market) and Market ID.

 

 

I wish to add a column that precedes the market id with 2 random integers and postcedes the market id with 2 random integers.

 

I have written the below Dax.

 

Market Mask =
var mkt = Markets[Market ID]
var randb4 =  RANDBETWEEN(50,99)
var randafter = RANDBETWEEN(50,99)
return  mkt
 
I'm retruning the market id by itself with no issue.

 

 

When I try to concantenate the random numbers to the returun expression, the return expression goes to a boolean value.

 

Market Mask =
var mkt = Markets[Market ID]
var randb4 =  RANDBETWEEN(50,99)
var randafter = RANDBETWEEN(50,99)
return  randb4 && mkt
 

 

I tried converting each expression to a string and the result is still the same.

 

Market Mask =
var mkt = Markets[Market ID]
var randb4 =  RANDBETWEEN(50,99)
var randafter = RANDBETWEEN(50,99)
return  convert(randb4,STRING) && convert(mkt,STRING)
 
 
My expressions for random numbers work fine without any concantenation also.
 
Market Mask =
var mkt = Markets[Market ID]
var randb4 =  RANDBETWEEN(50,99)
var randafter = RANDBETWEEN(50,99)
return randb4
 

 

How can I concantenate the 3 variables in my code together into one expression?

 

 

 

 

 
 
1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@mjanecek 

 

 

try using concatenate function 

Daniel29195_0-1706046597808.png

 

 

 

If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. Dont forget to hit that  thumbs up button 🫡👍

View solution in original post

1 REPLY 1
Daniel29195
Super User
Super User

@mjanecek 

 

 

try using concatenate function 

Daniel29195_0-1706046597808.png

 

 

 

If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. Dont forget to hit that  thumbs up button 🫡👍

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.